java

java

Java arraylist set method example

set method is used to replace one element in an ArrayList in Java. In this tutorial, I will show you how to use set method with one example.

Read
java

Java String concat example

concat() method is used to join two strings. It concatenates one string to the end of another string. This method is defined as below :.

Read
java

Java LinkedList poll, pollFirst and pollLast example

Java provides a utility class called LinkedList to create linked lists. Unlike any other programming languages like C, we can create one Linked list easily using this class.

Read
java

Java peek(), peekFirst() and peekLast() explanation with examples

Using LinkedList class, we can create one linked list in Java. This class provides a lot of different methods to operate on the elements of the linked list. In this tutorial, we will check three inbuilt methods peek(), peekFirst() and peekLast() of the LinkedList class.

Read
java

How to add elements to a Java vector using index

Vector is a good replacement of array in Java if you want to add elements dynamically. We can add elements dynamically to a vector and it will increase its size, unlike arrays. Previously we have learned different examples of vectors like [how to create vectors](https://www.codevscolor.com/java-print-vector-contents/), how to [add elements to a vector](https://www.codevscolor.com/add-elements-to-java-vector-using-index/) and how to [clear a vector](https://www.codevscolor.com/how-to-clear-vector-in-java/). In this tutorial, we will learn how to add elements to a vector in a specific position, i.e. using index numbers.

Read
java

How to compare Substrings in Java using regionMatches

Sometimes we need to compare two substrings in different string in Java. We can do that by comparing each character one by one of both strings but Java String class comes with a built-in method called regionMatches to make this task easier.

Read
java

Java program to print all contents of a vector using enumeration

In this tutorial, we will learn how to use enumeration to iterate over a vector in Java. Our program will first take the inputs for the vector from the user, it will then print out the inputs using enumeration.

Read
java

Java string compareToIgnoreCase and compareTo methods

Java String methods compareToIgnoreCase and compareTo can be used to compare two strings. In this tutorial, we will learn how these methods work with examples.

Read
java

Java example program to create one ArrayList of ArrayList

In this quick Java programming tutorial, I will show you how to create one ArrayList of ArrayList, i.e. an ArrayList with ArrayList elements.  The program will take all inputs from the user. It will take the ArrayList inputs and then print out the result.

Read
java

Java compareToIgnoreCase method explanation with an example

compareToIgnoreCase is a public method in the String class of Java. We can use this method to compare two Strings lexicographically and ignoring the case.The provided string is normalized by using Character.toLowerCase(Character.toUpperCase(character)) on each character of the String.

Read