ArrayList is serializable by default. This means you need not to implement Serializable interface explicitly in order to serialize an ArrayList. In this tutorial we will learn how… [Read More]
Difference between ArrayList and HashMap in Java
ArrayList and HashMap are two commonly used collection classes in Java. Even though both are the part of collection framework, the way they store and… [Read More]
How to join/combine two ArrayLists in java
In this tutorial we will see how to join (or Combine) two ArrayLists in Java. We will be using addAll() method to add both the… [Read More]
How to find length of ArrayList in Java
You can find the length (or size) of an ArrayList in Java using size() method. The size() method returns the number of elements present in… [Read More]
How to empty an ArrayList in Java
There are two ways to empty an ArrayList – By using ArrayList.clear() method or with the help of ArrayList.removeAll() method. Although both methods do the same… [Read More]
How to synchronize ArrayList in java with example
We have already discussed a bit about synchronization when we shared the tutorial on Vector vs ArrayList. As we are aware that ArrayList is non-synchronized… [Read More]
How to swap two elements in an ArrayList
This tutorial will help you understand how to swap two elements in an ArrayList. We are using Collections.swap() method for swapping. public static void swap(List… [Read More]
How to get sublist of an ArrayList with example
In this tutorial, we will see how to get a sublist from an existing ArrayList. We will be using the subList() method of ArrayList class…. [Read More]
ArrayList clone() method in Java
In this tutorial, we will see examples of ArrayList clone() method. This method creates a shallow copy of an ArrayList. Syntax: newList = oldList.clone() Creates… [Read More]
Copy Elements of One ArrayList to Another ArrayList in Java
In this tutorial, we will write a java program to copy elements of one ArrayList to another ArrayList in Java. We will be using addAll()… [Read More]
Difference between ArrayList and LinkedList in Java
In this guide, you will learn difference between ArrayList and LinkedList in Java. ArrayList and LinkedList both implements List interface and their methods and results… [Read More]
Difference between ArrayList and Vector in Java
ArrayList and Vector both use Array as a data structure internally. However there are key differences between these classes. In this guide, you will learn… [Read More]
Java ArrayList of Object Sort Example (Comparable & Comparator)
In this tutorial, you will learn how to sort an ArrayList of Objects by property using comparable and comparator interface. If you are looking for… [Read More]
How to sort ArrayList in descending order in Java
In this tutorial, you will learn how to sort an ArrayList in descending order. Example 1: Sorting an ArrayList in Descending order We are using… [Read More]
How to sort ArrayList in Java
In this tutorial, you will learn how to sort ArrayList in Java. We will see java programs in this guide, to sort an ArrayList in… [Read More]