0% found this document useful (0 votes)
36 views24 pages

Java List Interface

Uploaded by

Sunil Mane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views24 pages

Java List Interface

Uploaded by

Sunil Mane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

Java Course Java Arrays Java Strings Java OOPs Java Collection Java 8 Tutorial Java Multithrea

Java List Interface


Last Updated : 23 Nov, 2024

The List Interface in Java extends the Collection Interface and is a part
of java.util package. It is used to store the ordered collections of
elements. So in a Java List, you can organize and manage the data
sequentially.

Maintained the order of elements in which they are added.


Allows the duplicate elements.
The implementation classes of the List interface are ArrayList,
LinkedList, Stack, and Vector.
Can add Null values that depend on the implementation.
The List interface offers methods to access elements by their index
and includes the listIterator() method, which returns a ListIterator.
Using ListIterator, we can traverse the list in both forward and
backward directions.

Example:

Java

1 // Java program to show the use of List Interface


2 import java.util.*;
3
4 class GFG {
5
6 public static void main(String[] args)
7 {
8

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 1/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

9 // Creating a List of Strings using


ArrayList
10 List<String> li = new ArrayList<>();
11
12 // Adding elements in List
13 li.add("Java");
14 li.add("Python");
15 li.add("DSA");
16 li.add("C++");
17
18 System.out.println("Elements of List are:");
19
20 // Iterating through the list
21 for (String s : li) {
22 System.out.println(s);
23 }
24
25 // Accessing elements
26 System.out.println("Element at Index 1: "+
li.get(1));
27
28 // Updating elements
29 li.set(1, "JavaScript");
30 System.out.println("Updated List: " + li);
31
32 // Removing elements
33 li.remove("C++");
34 System.out.println("List After Removing
Element: " + li);
35 }
36 }

Output

Elements of List are:


Java
Python
DSA
C++
Element at Index 1: Python
Updated List: [Java, JavaScript, DSA, C++]
List After Removing Element: [Java, JavaScript, DSA]

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 2/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

Declaration of Java List Interface


public interface List<E> extends Collection<E> ;

Let us elaborate on creating objects or instances in a List. Since List is


an interface, objects cannot be created of the type list. We always need
a class that implements this List in order to create an object. And also,
after the introduction of Generics in Java 1.5, it is possible to restrict the
type of object that can be stored in the List. Just like several other user-
defined ‘interfaces’ implemented by user-defined ‘classes’, List is an
‘interface’, implemented by the ArrayList class, pre-defined in java.util
package.

Syntax:

List<Obj> list = new ArrayList<Obj> ();

Obj is the type of the object to be stored in List.

The common implementation classes of the List interface are ArrayList,


LinkedList, Stack, and Vector:

ArrayList and LinkedList are the most widely used due to their
dynamic resizing and efficient performance for specific operations.
Stack is a subclass of Vector, designed for Last-In-First-Out (LIFO)
operations.

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 3/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

Vector is considered a legacy class and is rarely used in modern Java


programming. It is replaced by ArrayList and java.util.concurrent
package.

Now let us perform various operations using List Interface to have a


better understanding of the same. We will be discussing the following
operations listed below and later on implementing them via clean Java
codes.

Java List – Operations


Since List is an interface, it can be used only with a class that
implements this interface. Now, let’s see how to perform a few
frequently used operations on the List.

Operation 1: Adding elements to List using add() method


Operation 2: Updating elements in List using set() method
Operation 3: Searching for elements using indexOf(), lastIndexOf
methods
Operation 4: Removing elements using remove() method
Operation 5: Accessing Elements in List using get() method
Operation 6: Checking if an element is present in the List using
contains() method

Now let us discuss the operations individually and implement the same
in the code to grasp a better grip over it.

1. Adding Elements

In order to add an element to the list, we can use the add() method.
This method is overloaded to perform multiple operations based on
different parameters.

Parameters: It takes 2 parameters, namely:

add(Object o): This method is used to add an element at the end of


the List.
add(int index, Object o): This method is used to add an element at a
specific index in the List

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 4/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

Note: If we do not specify the length of the array in the ArrayList


constructor while creating the List object, using add(int index, Object)
for any index i will throw an Exception if we have not specified the
values for 0 to i-1 index already.

Example:

Java

1 // Java Program to Add Elements to a List


2 import java.util.*;
3
4 class GFG {
5
6 public static void main(String args[])
7 {
8 // Creating an object of List interface,
9 // implemented by ArrayList class
10 List<String> al = new ArrayList<>();
11
12 // Adding elements to object of List
interface
13 // Custom elements
14 al.add("Geeks");
15 al.add("Geeks");
16 al.add(1, "For");
17
18 // Print all the elements inside the
19 // List interface object
20 System.out.println(al);
21 }
22 }

Output

[Geeks, For, Geeks]

2. Updating Elements

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 5/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

After adding the elements, if we wish to change the element, it can be


done using the set() method. Since List is indexed, the element which
we wish to change is referenced by the index of the element. Therefore,
this method takes an index and the updated element which needs to be
inserted at that index.

Example:

Java

1 // Java Program to Update Elements in a List


2 import java.util.*;
3
4 class GFG {
5
6 public static void main(String args[])
7 {
8 // Creating an object of List interface
9 List<String> al = new ArrayList<>();
10
11 // Adding elements to object of List class
12 al.add("Geeks");
13 al.add("Geeks");
14 al.add(1, "Geeks");
15
16 // Display theinitial elements in List
17 System.out.println("Initial ArrayList " +
al);
18
19 // Setting (updating) element at 1st index
20 // using set() method
21 al.set(1, "For");
22
23 // Print and display the updated List
24 System.out.println("Updated ArrayList " +
al);
25 }
26 }

Output

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 6/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

Initial ArrayList [Geeks, Geeks, Geeks]


Updated ArrayList [Geeks, For, Geeks]

3. Searching Elements

Searching for elements in the List interface is a common operation in


Java programming. The List interface provides several methods to
search for elements, such as the indexOf(), lastIndexOf() methods.

The indexOf() method returns the index of the first occurrence of a


specified element in the list, while the lastIndexOf() method returns the
index of the last occurrence of a specified element.

Parameters:

indexOf(Object o): Returns the index of the first occurrence of the


specified element in the list, or -1 if the element is not found
lastIndexOf(Object o): Returns the index of the last occurrence of
the specified element in the list, or -1 if the element is not found

Example:

Java

1 // Java program to search the elements in a List


2 import java.util.*;
3
4 class GFG {
5
6 public static void main(String[] args)
7 {
8 // create a list of integers
9 List<Integer> al = new ArrayList<>();
10
11 // add some integers to the list
12 al.add(1);
13 al.add(2);
14 al.add(3);
15 al.add(2);
16

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 7/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

17 // use indexOf() to find the first


occurrence of an
18 // element in the list
19 int i = al.indexOf(2);
20
21 System.out.println("First Occurrence of 2 is
at Index: "+i);
22
23 // use lastIndexOf() to find the last
occurrence of
24 // an element in the list
25 int l = al.lastIndexOf(2);
26
27 System.out.println("Last Occurrence of 2 is
at Index: "+l);
28 }
29 }

Output

First Occurrence of 2 is at Index: 1


Last Occurrence of 2 is at Index: 3

4. Removing Elements

In order to remove an element from a list, we can use the remove()


method. This method is overloaded to perform multiple operations
based on different parameters. They are:

Parameters:

remove(Object o): This method is used to simply remove an object


from the List. If there are multiple such objects, then the first
occurrence of the object is removed.
remove(int index): Since a List is indexed, this method takes an
integer value which simply removes the element present at that
specific index in the List. After removing the element, all the
elements are moved to the left to fill the space and the indices of the
objects are updated.

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 8/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

Example:

Java

1 // Java Program to Remove Elements from a List


2 import java.util.ArrayList;
3 import java.util.List;
4
5 class GFG {
6
7 public static void main(String args[])
8 {
9
10 // Creating List class object
11 List<String> al = new ArrayList<>();
12
13 // Adding elements to the object
14 // Custom inputs
15 al.add("Geeks");
16 al.add("Geeks");
17
18 // Adding For at 1st indexes
19 al.add(1, "For");
20
21 // Print the initialArrayList
22 System.out.println("Initial ArrayList " + al);
23
24 // Now remove element from the above list
25 // present at 1st index
26 al.remove(1);
27
28 // Print the List after removal of element
29 System.out.println("After the Index Removal "
30
31 // Now remove the current object from the upda
32 // List
33 al.remove("Geeks");
34
35 // Finally print the updated List now
36 System.out.println("After the Object Removal "
al);
37 }

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 9/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

38 }

Output

Initial ArrayList [Geeks, For, Geeks]


After the Index Removal [Geeks, Geeks]
After the Object Removal [Geeks]

5. Accessing Elements

In order to access an element in the list, we can use the get() method,
which returns the element at the specified index

Parameters:

get(int index): This method returns the element at the specified index
in the list.

Example:

Java

1 // Java Program to Access Elements of a List


2 import java.util.*;
3
4 class GFG {
5
6 public static void main(String args[])
7 {
8 // Creating an object of List interface,
9 // implemented by ArrayList class
10 List<String> al = new ArrayList<>();
11
12 // Adding elements to object of List
interface
13 al.add("Geeks");
14 al.add("For");
15 al.add("Geeks");
16
17 // Accessing elements using get() method
18 String first = al.get(0);
https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 10/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

19 String second = al.get(1);


20 String third = al.get(2);
21
22 // Printing all the elements inside the
23 // List interface object
24 System.out.println(first);
25 System.out.println(second);
26 System.out.println(third);
27 System.out.println(al);
28 }
29 }

Output

Geeks
For
Geeks
[Geeks, For, Geeks]

6. Checking if an element is present or not

In order to check if an element is present in the list, we can use the


contains() method. This method returns true if the specified element is
present in the list, otherwise, it returns false.

Parameters:

contains(Object o): This method takes a single parameter, the object


to be checked if it is present in the list.

Example:

Java

1 // Java Program to Check if an Element is Present in


a List
2 import java.util.*;
3
4 class GFG {
5

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 11/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

6 public static void main(String args[])


7 {
8 // Creating an object of List interface,
9 // implemented by ArrayList class
10 List<String> al = new ArrayList<>();
11
12 // Adding elements to object of List
interface
13 al.add("Geeks");
14 al.add("For");
15 al.add("Geeks");
16
17 // Checking if element is present using
contains()
18 // method
19 boolean isPresent = al.contains("Geeks");
20
21 // Printing the result
22 System.out.println("Is Geeks present in the
list? "+ isPresent);
23 }
24 }

Output

Is Geeks present in the list? true

Complexity of List Interface in Java

Operation Time Complexity Space Complexity

Adding Element in
O(1) O(1)
List Interface

Remove Element
O(N) O(N)
from List Interface

Replace Element in
O(N) O(N)
List Interface

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 12/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

Operation Time Complexity Space Complexity

Traversing List
O(N) O(N)
Interface

Iterating over List Interface in Java


Till now we are having a very small input size and we are doing
operations manually for every entity. Now let us discuss various ways
by which we can iterate over the list to get them working for a larger
sample set.

Methods: There are multiple ways to iterate through the List. The most
famous ways are by using the basic for loop in combination with a get()
method to get the element at a specific index and the advanced for a
loop.

Example:

Java

1 // Java program to Iterate the Elements


2 // in an List
3 import java.util.*;
4
5 public class GFG {
6
7 public static void main(String args[])
8 {
9 // Creating an empty Arraylist of string type
10 List<String> al = new ArrayList<>();
11
12 // Adding elements to above object of
ArrayList
13 al.add("Geeks");
14 al.add("Geeks");
15
16 // Adding element at specified position
17 // inside list object
18 al.add(1, "For");
19

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 13/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

20 // Using for loop for iteration


21 for (int i = 0; i < al.size(); i++) {
22
23 // Using get() method to
24 // access particular element
25 System.out.print(al.get(i) + " ");
26 }
27
28 // New line for better readability
29 System.out.println();
30
31 // Using for-each loop for iteration
32 for (String str : al)
33
34 // Printing all the elements
35 // which was inside object
36 System.out.print(str + " ");
37 }
38 }

Output

Geeks For Geeks


Geeks For Geeks

Methods of the List Interface


Since the main concept behind the different types of lists is the same,
the list interface contains the following methods:

Method Description

This method is used with Java List Interface


to add an element at a particular index in the
add(int index, element)
list. When a single parameter is passed, it
simply adds the element at the end of the list.

addAll(int index, This method is used with List Interface in Java


Collection collection) to add all the elements in the given collection
to the list. When a single parameter is

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 14/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

Method Description

passed, it adds all the elements of the given


collection at the end of the list.

This method is used with Java List Interface


size()
to return the size of the list.

This method is used to remove all the


clear() elements in the list. However, the reference
of the list created is still stored.

This method removes an element from the


specified index. It shifts subsequent
remove(int index)
elements(if any) to left and decreases their
indexes by 1.

This method is used with Java List Interface


remove(element) to remove the first occurrence of the given
element in the list.

This method returns elements at the specified


get(int index)
index.

This method replaces elements at a given


index with the new element. This function
set(int index, element)
returns the element which was just replaced
by a new element.

This method returns the first occurrence of


indexOf(element) the given element or -1 if the element is not
present in the list.

This method returns the last occurrence of


lastIndexOf(element) the given element or -1 if the element is not
present in the list.

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 15/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

Method Description

This method is used with Java List Interface


equals(element) to compare the equality of the given element
with the elements of the list.

This method is used with List Interface in Java


hashCode()
to return the hashcode value of the given list.

This method is used with Java List Interface


isEmpty() to check if the list is empty or not. It returns
true if the list is empty, else false.

This method is used with List Interface in Java


to check if the list contains the given element
contains(element)
or not. It returns true if the list contains the
element.

This method is used with Java List Interface


containsAll(Collection
to check if the list contains all the collection
collection)
of elements.

This method is used with List Interface in Java


sort(Comparator comp) to sort the elements of the list on the basis of
the given comparator.

Java List vs Set


Both the List interface and the Set interface inherits the Collection
interface. However, there exists some differences between them.

List Set

The List is an ordered sequence. The Set is an unordered sequence.

Set doesn’t allow duplicate


List allows duplicate elements
elements.

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 16/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

List Set

Elements by their position can be Position access to elements is not


accessed. allowed.

Multiple null elements can be The null element can store only
stored. once.

List implementations are ArrayList, Set implementations are HashSet,


LinkedList, Vector, Stack LinkedHashSet.

Classes Association with a Java List Interface

Now let us discuss the classes that implement the List Interface for
which first do refer to the pictorial representation below to have a better
understanding of the List interface. It is as follows:

AbstractList, CopyOnWriteArrayList, and the AbstractSequentialList are


the classes that implement the List interface. A separate functionality is
implemented in each of the mentioned classes. They are as follows:

1. AbstractList: This class is used to implement an unmodifiable list, for


which one needs to only extend this AbstractList Class and
implement only the get() and the size() methods.
2. CopyOnWriteArrayList: This class implements the list interface. It is
an enhanced version of ArrayList in which all the modifications(add,

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 17/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

set, remove, etc.) are implemented by making a fresh copy of the list.
3. AbstractSequentialList: This class implements the Collection
interface and the AbstractCollection class. This class is used to
implement an unmodifiable list, for which one needs to only extend
this AbstractList Class and implement only the get() and the size()
methods.

We will proceed in this manner.

ArrayList
Vector
Stack
LinkedList

Let us discuss them sequentially and implement the same to figure out
the working of the classes with the List interface.

1. ArrayList

An ArrayList class which is implemented in the collection framework


provides us with dynamic arrays in Java. Though, it may be slower than
standard arrays but can be helpful in programs where lots of
manipulation in the array is needed. Let’s see how to create a list object
using this class.

Example:

Java

1 // Java program to demonstrate the


2 // creation of list object using the
3 // ArrayList class
4
5 import java.io.*;
6 import java.util.*;
7
8 class GFG {
9 public static void main(String[] args)
10 {
11 // Size of ArrayList
https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 18/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

12 int n = 5;
13
14 // Declaring the List with initial size n
15 List<Integer> arrli = new ArrayList<Integer>
(n);
16
17 // Appending the new elements
18 // at the end of the list
19 for (int i = 1; i <= n; i++)
20 arrli.add(i);
21
22 // Printing elements
23 System.out.println(arrli);
24
25 // Remove element at index 3
26 arrli.remove(3);
27
28 // Displaying the list after deletion
29 System.out.println(arrli);
30
31 // Printing elements one by one
32 for (int i = 0; i < arrli.size(); i++)
33 System.out.print(arrli.get(i) + " ");
34 }
35 }

Output

[1, 2, 3, 4, 5]
[1, 2, 3, 5]
1 2 3 5

2. Vector

Vector is a class that is implemented in the collection framework


implements a growable array of objects. Vector implements a dynamic
array that means it can grow or shrink as required. Like an array, it
contains components that can be accessed using an integer index.
Vectors basically fall in legacy classes but now it is fully compatible
with collections. Let’s see how to create a list object using this class.

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 19/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

Example:

Java

1 // Java program to demonstrate the


2 // creation of list object using the
3 // Vector class
4
5 import java.io.*;
6 import java.util.*;
7
8 class GFG {
9 public static void main(String[] args)
10 {
11 // Size of the vector
12 int n = 5;
13
14 // Declaring the List with initial size n
15 List<Integer> v = new Vector<Integer>(n);
16
17 // Appending the new elements
18 // at the end of the list
19 for (int i = 1; i <= n; i++)
20 v.add(i);
21
22 // Printing elements
23 System.out.println(v);
24
25 // Remove element at index 3
26 v.remove(3);
27
28 // Displaying the list after deletion
29 System.out.println(v);
30
31 // Printing elements one by one
32 for (int i = 0; i < v.size(); i++)
33 System.out.print(v.get(i) + " ");
34 }
35 }

Output

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 20/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

[1, 2, 3, 4, 5]
[1, 2, 3, 5]
1 2 3 5

3. Stack

Stack is a class that is implemented in the collection framework and


extends the vector class models and implements the Stack data
structure. The class is based on the basic principle of last-in-first-out. In
addition to the basic push and pop operations, the class provides three
more functions of empty, search and peek. Let’s see how to create a list
object using this class.

Example:

Java

1 // Java program to demonstrate the


2 // creation of list object using the
3 // Stack class
4
5 import java.io.*;
6 import java.util.*;
7
8 class GFG {
9 public static void main(String[] args)
10 {
11 // Size of the stack
12 int n = 5;
13
14 // Declaring the List
15 List<Integer> s = new Stack<Integer>();
16
17 // Appending the new elements
18 // at the end of the list
19 for (int i = 1; i <= n; i++)
20 s.add(i);
21
22 // Printing elements
23 System.out.println(s);
24

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 21/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

25 // Remove element at index 3


26 s.remove(3);
27
28 // Displaying the list after deletion
29 System.out.println(s);
30
31 // Printing elements one by one
32 for (int i = 0; i < s.size(); i++)
33 System.out.print(s.get(i) + " ");
34 }
35 }

Output

[1, 2, 3, 4, 5]
[1, 2, 3, 5]
1 2 3 5

4. LinkedList

LinkedList is a class that is implemented in the collection framework


which inherently implements the linked list data structure. It is a linear
data structure where the elements are not stored in contiguous
locations and every element is a separate object with a data part and
address part. The elements are linked using pointers and addresses.
Each element is known as a node. Due to the dynamicity and ease of
insertions and deletions, they are preferred over the arrays. Let’s see
how to create a list object using this class.

Example:

Java

1 // Java program to demonstrate the


2 // creation of list object using the
3 // LinkedList class
4
5 import java.io.*;
6 import java.util.*;

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 22/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

7
8 class GFG {
9 public static void main(String[] args)
10 {
11 // Size of the LinkedList
12 int n = 5;
13
14 // Declaring the List with initial size n
15 List<Integer> ll = new LinkedList<Integer>
();
16
17 // Appending the new elements
18 // at the end of the list
19 for (int i = 1; i <= n; i++)
20 ll.add(i);
21
22 // Printing elements
23 System.out.println(ll);
24
25 // Remove element at index 3
26 ll.remove(3);
27
28 // Displaying the list after deletion
29 System.out.println(ll);
30
31 // Printing elements one by one
32 for (int i = 0; i < ll.size(); i++)
33 System.out.print(ll.get(i) + " ");
34 }
35 }

Output

[1, 2, 3, 4, 5]
[1, 2, 3, 5]
1 2 3 5

Want to be a master in Backend Development with Java for building


robust and scalable applications? Enroll in Java Backend and
Development Live Course by GeeksforGeeks to get your hands dirty

https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 23/29
12/24/24, 7:16 PM Java List Interface - GeeksforGeeks

with Backend Programming. Master the key Java concepts, server-side


programming, database integration, and more through hands-on
experiences and live projects. Are you new to Backend development or
want to be a Java Pro? This course equips you with all you need for
building high-performance, heavy-loaded backend systems in Java.
Ready to take your Java Backend skills to the next level? Enroll now and
take your development career to sky highs.

Comment More info Next Article


ArrayList in Java

List Interface in Java Visit Course

Similar Reads
Why to Use Comparator Interface Rather than Comparable Interface…
In Java, the Comparable and Comparator interfaces are used to sort
collections of objects based on certain criteria. The Comparable interface…
9 min read

How to Test Java List Interface Methods using Mockito?


https://www.geeksforgeeks.org/list-interface-java-examples/?ref=next_article 24/29

You might also like