?????????????????????????????????????λ??i??????key?????????????????????????????addEntry(hash?? key?? value?? i)??????
????void addEntry(int hash?? K key?? V value?? int bucketIndex) {
????Entry<K??V> e = table[bucketIndex];
????table[bucketIndex] = new Entry<K??V>(hash?? key?? value?? e);
????if (size++ >= threshold)
????resize(2 * table.length);
????}
??????????μ?????table[i]λ??????????????(??????null??????????????)?????????????μ??????next?С??γ??μ??????
???????????????map??get(key)???????????????put????????????

 

public V get(Object key) {
if (key == null)
return getForNullKey();
int hash = hash(key.hashCode());
for (Entry<K??V> e = table[indexFor(hash?? table.length)];
e != null;
e = e.next) {
Object k;
if (e.hash == hash && ((k = e.key) == key || key.equals(k)))
return e.value;
}
return null;
}

?????????ж?key == null?? ????true?????????getForNullKey()??????????table[0]??????????????key?????table[0]?????????????
????private V getForNullKey() {
????for (Entry<K??V> e = table[0]; e != null; e = e.next) {
????if (e.key == null)
????return e.value;
????}
????return null;
????}
???????key == null ?false?????????get???????°???????hashCode???hash?????hash??table.length???λ??i??????table[i]?????????ken????????????

 

int hash = hash(key.hashCode());
for (Entry<K??V> e = table[indexFor(hash?? table.length)];
e != null;
e = e.next) {
Object k;
if (e.hash == hash && ((k = e.key) == key || key.equals(k)))
return e.value;
}
return null;

?????????????Java?????漲????2???????equals???????hashCode?????????????hashCode???equals?????????????hashmap??????Java??????????????????????г????????????????????????????????hashCode??????????2??????equals????????hashcode?????????????2??????????hashmap???????????hashmap?????key????????????hashmap??
????д???????HashMap????????????д???????????????????????HashMap????????????????????涼?У????????????