Category: ArrayList in Java

Replace the value of existing element in ArrayList 0

Replace the value of existing element in ArrayList

In the previous post, we have seen how to swap two values in arrayList.In this post, we will learn how to replace the value of existing element in ArrayList. We can use the method...

Swap two elements in arrayList 0

Swap two elements in arrayList

In the previous post, we have seen how to compare two arrayLists. In this post, we will see how to swap two elements in arrayList. We have a method called Collections.swap()  which is used...

Compare two arrayLists in java 0

Compare two arrayLists in java

In the previous post, we have seen how to find out first and last occurrence of elements in arrayList. In this post , we will see how to compare two arrayLists in java. We...

Find out first and last occurrence of elements in ArrayList 0

Find out first and last occurrence of elements in ArrayList

In the previous post, we have seen how to find the sublist in a arrayList. In this post, we will see how to find out first and last occurrence of elements in ArrayList. Let’s...

Find SubList of ArrayList 0

Find SubList of ArrayList

In the previous post, we have seen how to sort the arrayList by using comparable and comparator.In this post, we will see how to get a sublist from a ArrayList. Find SubList of ArrayList:...

Sort ArrayList of Objects using Comparable and Comparator interface 0

Sort ArrayList of Objects using Comparable and Comparator interface

In the previous post, we have seen how to sort arraylist in descending order. In that post , we have sorted out the arraylist for String and Integer values. We have used Collections.sort() method...

Sort the ArrayList in descending order 0

Sort the ArrayList in descending order

In the previous post, we have seen how to sort the arrayList. In this post, we will see how to sort the arrayList in descending order. We will use the method Collections.reverseOrder() to sort the...

Sort ArrayList in java 0

Sort ArrayList in java

In the previous post, we have seen how to remove an element at a specified index. In this post, we will see how to sort arraylist in java. We use the collections class to...

Remove an element  at a particular index from the array list 0

Remove an element at a particular index from the array list

In the previous post, we have seen how to remove a specified element from  the arraylist. In this post, we will see how to remove an element  at a particular index from the array...

Remove a specified element from the array List 0

Remove a specified element from the array List

In the previous post, we have seen how to add a collection of elements at a particular index in the arraylist. In this post, we will see how to remove a specified element from...