Java List.hashCode()

Syntax

List.hashCode() has the following syntax.

int hashCode()

Example

In the following code shows how to use List.hashCode() method.


/*  w ww  .  j a  v  a  2 s .c o  m*/
import java.util.Arrays;
import java.util.List;
public class Main {
  public static void main(String[] a) {
    List list = Arrays.asList(new String[] { "A", "B", "C", "D" });
    System.out.println(list.size());
    System.out.println(list.hashCode());
  }
}

The code above generates the following result.