In this guide, you will learn how to rotate a list in Java. Rotation means shifting of elements, for example rotating a list to right… [Read More]
Calculate Average of List in Java
In this tutorial, you will learn how to calculate average of a List in Java. This can be done on ArrayList of numbers such as… [Read More]
Convert JSON Array to ArrayList in Java
In this guide, you will learn how to convert JSON array to ArrayList in Java. To parse the given JSON data, you can use org.json… [Read More]
How to Convert ArrayList to HashSet in Java
There are several ways to convert ArrayList to HashSet. In this guide, we will discuss the following ways with examples: Passing ArrayList to constructor of… [Read More]
When to use ArrayList and LinkedList in Java
In this guide, we will discuss, when to use ArrayList and when to use LinkedList in Java. There are multiple similarities between these classes. However… [Read More]
How to Increase the capacity of ArrayList
When we create an ArrayList in Java, it is created with a default capacity of 10. However an ArrayList can be automatically resized if more… [Read More]
Perform Binary Search on ArrayList in Java
In this tutorial, you will learn how to perform binary search on ArrayList in Java. 1. Perform binary search on ArrayList using Collections.binarySearch() In this… [Read More]
Add Multiple Items to an ArrayList in Java
In this tutorial, you will learn how to add multiple items to an ArrayList in Java. 1. Add multiple items using adAll() method The addAll()… [Read More]
Difference between Array and ArrayList
In this guide, we will discuss the difference between Array and ArrayList. What is an Array? An array is a collection of elements of similar… [Read More]
Difference between length of Array and size of ArrayList in Java
In this tutorial, you will learn the difference between length of Array and size of ArrayList in Java.. Length of Array: // creating an array… [Read More]
How to make an ArrayList read only in Java
A read only ArrayList means that no modification operations is allowed to be performed on ArrayList. This list cannot be modified by adding, removing or… [Read More]
Java – How to Convert a String to ArrayList
In this java tutorial, you will learn how to convert a String to an ArrayList. Input: 22,33,44,55,66,77 Delimiter: , (comma) Output: ArrayList with 6 elements… [Read More]
How to remove duplicates from ArrayList in Java
In this tutorial, you will learn how to remove duplicates from ArrayList. Example 1: Removing duplicates from ArrayList using LinkedHashSet In the following example, we… [Read More]
How to get the last element of Arraylist?
There are times when we need to get the last element of an ArrayList, this gets difficult when we don’t know the last index of… [Read More]
Convert HashSet to a List/ArrayList
In this tutorial we will be learning how to convert a HashSet to a List (ArrayList). Program Here we have a HashSet of String elements… [Read More]
- 1
- 2
- 3
- 4
- Next Page »