欢迎来到天天文库
浏览记录
ID:30784062
大小:437.71 KB
页数:27页
时间:2019-01-03
《【java集合源码剖析】hashmap源码剖析-编程开发技术》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、i%Java*4^°IOzAe^EIojHashMapOzAe^EId・±a3I"必血°IOxAeyEEId;^HashMapOzAe2EEI0dlA3dx;£°A^fo^OeHashMap%6%6HashMapEQ»u6u1t)I£±iEpIO
2、jA£-.Aid»>d6aE0EQd»5dkey-value(
3、[O£--2EaAU2ir1yM¥Az±i!4a%63aI>>iEia£-EYA^^>xa£-^^AE-§dM£©E±£-HNu>>axd(
4、rO63Ki£HashMapEQQIB3iO2E«pA£-.O»EQ6
5、A6Ug¥IB3i»-%3IA£H<
6、[aiB3i»%3iAiEdO2E6Aco••八••ncurrent20-0ouIApAconcuiTentHashMapi£HashMap?电讥OA总Serializable%。汩£「06生创0§30D6AD»・£「卽的A^Cloneable!4O^U£-iAU±»^,EAjj£HashMapO'Ae^EIoHashMappAOzAeE9lA(%6EeAE±E!4IIet
7、jAx^EI)£opackagejava.util;importjava.io.*;publieclassH
8、ashMapextendsAbstractM^pcK,V>implementsMapzCloneable,Serializable//A->EIpA36E^EYAi£,,EYAii^HashMapbD2UpAEyAi£©E(;16£-'CdEp^EEYAi±0DeEC2pA6QEyzIAYj£staticfinalintDEFAULT_INITIAL_CAPACITY=16;//xlzoEYAi£,,±0DeE(;2pAAY(;dDjOU2pA30yI^L~>«EeEYA^1yzo^«±»Oa4oO
9、pi«»»£©staticfinalintMAXIMUM_CAPACITY=1<<30;//A^EI^660Odx6la0.75staticfinalfloatDEFAULT_LOAD_FACTOR=0.75f;//z«z<^Ey^YpAEntryFf><6£「?口勺总总£//HashMap2EOAAz±£--^a^o3af»£^AcO»,dEntry士%。总总『总,6卩¥工6入’士itransientEntry[]table;//HashMappApx2aEyxeODONOA2UpAEyAetransientint
10、size;//HashMappAaBOpL-^OAOUAB^IEQ・fiEQbQpwOdHdshMdpHA它£Az£“th:reshol.d=EYAc*^6606dxO£©intthreshold;//^OOOOdxOEp^EzoDifinalfloatloadFactor;//HashMap±»,A±apAxIEytransientvolatileintmodCount;//6旷i°EYAczoB;i±2Ijo^6O0bdx6i±pA1^ie-EypublicHashMap(intinitialcapacity,fl
11、oatloadFactor){if(initialcapacity<0)thrownewIIlegalArgumentException(11Illegalinitialcapacity:lf+initialcapacity);//HashMappAxiz6EYAiO»AUECMAXIMUM_CAPACITYif(initialcapacity>MAXIMUM_CAPACITY)initialcapacity=MAXIMUM_CAPACITY;//^OOOOozE2»AUDjOUOif(lo且dF且ctor<=0
12、
13、F
14、loat.isNaN(Io且dF且ctor))thrownew11legalArgumentException(nIllegalloadfactor:n+loadFactor);//OO3dJ0zoOUinitialCapacityi士pAxiojpA2pAAYintcapacity=1;while(capacity15、shMapODz®zCEy^YpAEyA^,'ip^thresholdE±£_,^fBed^^«HashMappAEYA<;^O±^[£threshold=(int)(capacity*loadFactor);//zz^,-EntryEyxe£^OAAz±£z$Ey^Ytable=newEntry[capacity];init(
15、shMapODz®zCEy^YpAEyA^,'ip^thresholdE±£_,^fBed^^«HashMappAEYA<;^O±^[£threshold=(int)(capacity*loadFactor);//zz^,-EntryEyxe£^OAAz±£z$Ey^Ytable=newEntry[capacity];init(
此文档下载收益归作者所有