散列码(hashcode)是由对象导出的一个整形值。散列码,是没有规律的。如果x和y是两个不同的对象,x.hashCode()和y.hashCode()基本上不会相同。
java.util.Object 1.0
int hashCode() 返回对象的散列码(对象的存储地址)。
值得注意的是String类重写了hashCode()方法,String对象的散列码是由字符串的内容导出的。
java.util.Objects 1.2
static int hash(Object......Objects) 返回一个散列码,由提供的所有对象的散列码组合而得到。
static int hashCode(Object a)如果a为null返回0,否则返回a.hashCode()。
java.util.Arrays 1.2
static int hashCode(type[] a) 5.0
计算数组a的散列码。数组类型:object int long short char byte boolean float double