Online Java Compiler By
JavaTpoint.com
import java.util.ArrayList; import java.util.List; public class JavaListHashCodeExample1 { public static void main(String[] args) { List
list = new ArrayList<>(); list.add(5); list.add(51); list.add(52); //returns the hash code value for this list for (Integer i : list) { int val = i.hashCode(); System.out.println("Hash Code for "+i+" : "+val); } } }
Output