Here you can find the source of hashCode(Object object)
public static int hashCode(Object object)
//package com.java2s; //License from project: Apache License import java.util.Arrays; public class Main { public static int hashCode(Object object) { if (object == null) { return 0; } else if (object instanceof Object[]) { return Arrays.deepHashCode((Object[]) object); } else if (object instanceof int[]) { return Arrays.hashCode((int[]) object); } else if (object instanceof long[]) { return Arrays.hashCode((long[]) object); } else if (object instanceof short[]) { return Arrays.hashCode((short[]) object); } else if (object instanceof byte[]) { return Arrays.hashCode((byte[]) object); } else if (object instanceof double[]) { return Arrays.hashCode((double[]) object); } else if (object instanceof float[]) { return Arrays.hashCode((float[]) object); } else if (object instanceof char[]) { return Arrays.hashCode((char[]) object); } else if (object instanceof boolean[]) { return Arrays.hashCode((boolean[]) object); } else {//from w w w . j av a 2s .c o m return object.hashCode(); } } }