????20.Map?????????Щ?????????????
????Map??????????????????
??????1??Set keyset()??????map?а?????????key?????Set?????????????map?????map??仯????????з??????????????????????????????????????????????map????????????????????????????????????????????????δ???塣??????????Iterator??Remove??Set.remove??removeAll??retainAll??clear??????????????????map????????????????????add??addAll??????
??????2??Collection values()?????????map?а?????????value?????Collection????????collection??map?????map??仯????collection?з?????????????????????????????????????collection?????map????????????????????????????????????????????????δ???塣??????????Iterator??Remove??Set.remove??removeAll??retainAll??clear??????????????????map????????????????????add??addAll??????
??????3??Set<Map.Entry<K??V>>entrySet()?????????map????????????????????????????????????map?????map??仯????collection?з??????????????????????????????????????????????map?????????????????????????????????????????????entry????setValue??????????????????δ???塣??????????Iterator??Remove??Set.remove??removeAll??retainAll??clear??????????????????map????????????????????add??addAll??????
????21.HashMap??HashTable?кβ????
??????1??HashMap????key??value?null????HashTable???????
??????2??HashTable??????????HashMap?????????HashMap????????????HashTable????????????
??????3????Java1.4????????LinkedHashMap??HashMap?????????????????????????????????HashMap???LinkedHashMap??????HashTable????????????????????????????
??????4??HashMap????key??Set???б????????????fail-fast?????HashTable????key??Enumeration???б????????????fail-fast??
??????5??HashTable????????????????????????????????????Map??????????CocurrentHashMap??
????22.??ξ??????HashMap????TreeMap??
??????????Map?в?????????λ????????????HashMap???????????????????????????????key??????б?????TreeMap????????????????collection???С???????HashMap??????????????map???TreeMap????????key???????
????23.ArrayList??Vector?к??????
????ArrayList??Vector??????????????
??????1???????????????????????????????????
??????2??????????????????????????????????????????
??????3??ArrayList??Vector?????????????fail-fast???
??????4??ArrayList??Vector????????null????????????????????????????????
??????????ArrayList??Vector??????
??????1??Vector??????????ArrayList??????????????????????????????б???и??????????CopyOnWriteArrayList??
??????2??ArrayList??Vector??????????????????????
??????3??ArrayList?????????????????????Collections?????????????????б??????б??
????24.Array??ArrayList?к????????????????Array??
????Array?????????????????????ArrayList??????????
????Array???????С?????ArrayList??С???????
????Array?????ArrayList????????????addAll??removeAll??iterator???????ArrayList??????????????????Щ???Array?????á?
??????1??????б???С???????????????????洢??????????
??????2??????????????????????????Collections?????????????????????????????С???????????б??????????ú?????
??????3????????????????飬???[][]??List<List<>>???????
????25.ArrayList??LinkedList?к?????
????ArrayList??LinkedList??????????List?????????????????Щ?????
??????1??ArrayList????Array?????????????????????????????????????????????????????O(1)????LinkedList?洢???е?????????????????????????????????????????????????????????????????????????????????????????????????????????????????臨????O(n)????ArrayList?????
??????2????ArrayList??????LinkedList?в?????????????????????????????????????м??????????漰?????????С?????????????
??????3??LinkedList??ArrayList??????????棬???LinkedList?е???????洢???????????á?
????26.??Щ??????????????????????
????ArrayList??HashMap??TreeMap??HashTable??????????????????
????27.EnumSet??????
????java.util.EnumSet???????????????????????????????????????е?????????????????????????????????????????????????EnumSet?????????????????null??????????????Щ??????????????copyOf(Collection c)??of(E first??E…rest)??complementOf(EnumSet s)??
????28.??Щ????????????????
????Vector??HashTable??Properties??Stack??????????????????????????????????????????á?Java1.5????API?????Щ???????????????????????????????????????????????????????????????????
????29.????????????????
????Java1.5????????java.util.concurrent??????????????????????????????????????????????fail-fast????????ConcurrentModificationException????????????CopyOnWriteArrayList??ConcurrentHashMap??CopyOnWriteArraySet??
????30.BlockingQueue??????
????Java.util.concurrent.BlockingQueue????????У?????м???????????????????????????б?????????????????????????????????е??????BlockingQueue?????Java?????????????????????????????-???????????????????????????????п???????????????п????????????????BlockingQueue????????б????????Java???????BlockingQueue??????????ArrayBlockingQueue??LinkedBlockingQueue??PriorityBlockingQueue????SynchronousQueue???
????31.???к?????????г??????????
???????????????????????洢?????java.util.Queue????????????????????Java???????С?????????????????FIFO??????????????????????????Deque???????????????????
?????????к????????????????????к???????LIFO?????м?????
????Stack??????????Vector??????Queue?????????
????32.Collections????????
????Java.util.Collections????????????????????????????????????????????????????????????????????????????????????????????Щ???????????????????????????????????????????????????????
????33.Comparable??Comparator?????????
????????????????Array??Collection????????????????????????????Java??Comparable????Comparable?????compareTo(T OBJ)????????????????????á??????????д????????????“this”?????????????????С?????????????????????????????0????????????????????????????£???????????????????????????磬??????CEO?????????????н????????????HR???????????????????????????????????Comparator???????????Comparable.compareTo(Object o)??????????????????ν?????????????????????????????????Ρ?Comparator????compare(Object o1??Object o2)?????????????????????????????????????????????С?????????????????????????????????0????????????????????????????
????34.Comparable??Comparator????к?????
????Comparable??Comparator?????????????????????????????Comparable??????????????????????????????????????????????????????
????Comparator????????????????????????????????????????Comparator?????????????????????
????35.??????ζ??????????????
????????????????????????????????????????????Arrays.sort()????????????????????????????б????????????Collection.sort()????????????????????????????Comparable??????????????????Comparator???????????sort()??Collections??????????????????????????????????????????????Collections???????佫?б????????顣
????36.??????????????????????????????????β??????????????????????
???????????????????????????????Collections.unmodifiableCollection(Collection c)??????????????????????????伯????κβ??????????UnsupportedOperationException??
????37.??????δ?????????????????synchronized??????
??????????????Collections.synchronizedCollection(Collection c)???????????????????synchronized???????????????
????38.?????????????????????Щ??
????Java??????????????????????????????????Collections???????Щ???????????????????List??????????????????????????????????????????????????????С???
????39.??д??O????????????????
??????д??O???????????????е????????????????????????Collection??????????????????????????????????????????д??O??????????????磺????1??ArrayList??get(index i)?????????????????????????list??????????????????????????O(1)??????2???????????????б??????????????????O(n)???????????????????е???????????????????
????40.??Java??????????????Щ????????
??????1????????????????????????????磬?????????С??????????Array????ArrayList??????????????????????????Map????????????TreeMap???????????????????????????Set??
??????2???Щ??????????????????????????????????????????洢?????????????????????????????????1?????С??????
??????3????????????????????????????????????????????????
??????4????????????????????????????????????ClassCastException??
??????5?????JDK?????????????Map??key???????????????hashCode()??equals()??
??????6???????????Collections?????????????????????????????????д???????????????????????????????????????????????????