![]() |
VOOZH | about |
The List equals() method is used to compare two lists. It compares the lists as, both lists should have the same size, and all corresponding pairs of elements in the two lists are equal.
Implementation:
Equal
boolean equals(Object o)
Below programs show the implementation of this method.
Program 1: (Demonstrate different Type in Collection - ArrayList and LinkedList)
[10, 15, 20] [100, 200, 300] Not equal
Program 2: The Case where values are equal.
[10, 15, 20] [10, 15, 20] Equal