Here you can find the source of hashCode(Object o)
Return a proper hashCode for the given object.
Parameter | Description |
---|---|
o | the object |
public static int hashCode(Object o)
//package com.java2s; //License from project: LGPL import java.util.*; public class Main { /**/*www . j a v a 2 s . c o m*/ * <p>Return a proper hashCode for the given object. If the object is an array, the appropriate hashCode method in * the {@link Arrays} class will be called.</p> * @param o the object * @return a hash code for the object */ public static int hashCode(Object o) { if (o instanceof boolean[]) { return Arrays.hashCode((boolean[]) o); } else if (o instanceof byte[]) { return Arrays.hashCode((byte[]) o); } else if (o instanceof short[]) { return Arrays.hashCode((short[]) o); } else if (o instanceof char[]) { return Arrays.hashCode((char[]) o); } else if (o instanceof int[]) { return Arrays.hashCode((int[]) o); } else if (o instanceof long[]) { return Arrays.hashCode((long[]) o); } else if (o instanceof float[]) { return Arrays.hashCode((float[]) o); } else if (o instanceof double[]) { return Arrays.hashCode((double[]) o); } else if (o instanceof Object[]) { return Arrays.deepHashCode((Object[]) o); } else { return Objects.hashCode(o); } } }