Java??Map???????????????????
???????????? ???????[ 2013/12/27 11:38:12 ] ???????????? java
????HashMap??put????????????
????1???????key????hashCode()??????????л??????key??????????int????????key??????????????int????????int?????hash??????hash???
????2?????hash????Entry??????±??????????±????????????????????????????????key??hash???б????????????????????????
????3???????????????addentry()????????????????????±??У???????????key??hash???
????????仰????????????????key??hash????????????±?????????±???????????????????????б???????????????????put?????
??????????????Map?е?key???????????? ????Map??put???????????????????????
?????????????key?1??value?"zhangSan"??????hash?????101????????101?????????±????hash=101??key=1??value="zhangSan"????????????????????????101?±???????????key??????????hash???????????HashMap??????????
????get??
public V get(Object key) {
if (key == null)
return getForNullKey();
int hash = hash(key.hashCode());
for (Entry<</SPAN>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??????????????????key?????hash?????????????hash?????±????????????????????????value????
???????????????ж???????????????????????
??????????????????????????????????????????????????????????????????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11