Java Collection Tutorial - Java List.equals(Object o)


List.equals(Object o) has the following syntax.

boolean equals(Object o)


In the following code shows how to use List.equals(Object o) method.

import java.util.Arrays;
import java.util.List;
/* www  .  j  a v a2  s  .co m*/
public class Main {

  public static void main(String[] a) {

    List list = Arrays.asList(new String[] { "A", "B", "C", "D" });
    List list2 = Arrays.asList(new String[] { "A", "B", "C" });


The code above generates the following result.