HashMap 中获取 Hash 值的方法 首先判断 key 是否为 null,为 null 则返回 0 ,所以 key 为空的元素对应的数组坐标一定是 0,而且根据 put 会覆盖相同 key 的逻辑来思考,key 为空的元素最多只有一个。不为 null 则返回 key 的 hashCode异或上它的高16位。 static final int hash(Object key) { int h; return (key == null) ? 0 : (h