1.hashmap实现采用hashcode
hashCode() 返回值来计算 Hash 码的方法:hash(),其方法如下:
static int hash(int h)
{
h ^= (h >>> 20) ^ (h >>> 12);
return h ^ (h >>> 7) ^ (h >>> 4);
}
2.根据hashcode锁定存储位置
static int indexFor(int h, int length)
{
return h & (length-1);
}
3.hashmap存储key-value的结构是Entry
4.hashmap是非线程安全的
线程安全使用ConcurrentHashMap