????1?????
void add??index??element??
void add??index??collection??
????2 ???
????Object remove??index??
????3 ????
????object set??index??element??
????4?????
object get(index);
int indextOf(object);
int lastIndexOf(object)
List subList(from ??to);
????HashSet?????Set?List???????Collection??????????????????????????List???????????Array???????????Set??????HashMap???????????????????Set??List?????????HashSet??洢??????HashMap?е?Key???Set?????洢?????HashSet??add??Object obj??????????????????????
public boolean add(Object obj)
{
return map.put(obj?? PRESENT) == null;
}
???????????????Set?в???????List????????????????????????HashMap??key?????????????
????LinkedHashSet??HashSet?????????????????
????TreeSet??SortedSet?????????????HashSet???????TreeSet???????????????SortedMap???????
????Set???
????1. Set?????????Map??HashMap????
????2. Set?е?????????????????????add(Object obj)??????????????????????????????
??????????ü????? ?
????????????????????????????????????????????????±????????????????????????????????
???????????
??????????????java.util???С?
??????????????????????????????????????????????????????????е????????????ж?????????reference)??
?????????????????3???set(??????list(?б????map(???)??
????(1)??
????????set?????????????????????????????????????????????????У????????????????
????????г???????????????????ж???????y??е????????в????????????
????????ж?????壬??????????????????TreeSet????????????????е???????????????????????????????????????С?????????SortedSet??????????????????????????????е????????????????????????????????
????(2)?б?
?????б?????????????????????????洢???????????????????????????β??????????????????????????????б?????????з????????????????????????????????С?
????????????б?????????????????????о??????????????????????????
????(3)???
????????????б???????????????????????????????д洢???????????????????????Key?????????????????????????е?洢λ????????????????????????????????????в鵥????????????????????????????????????????洢λ?????????????????(hashing)?????????????????????????????(hash code)?????????
??????????????????????????????????????????????????????????λ???????????????/??????洢λ?á?????????£???д?????ò?????????Χ??????????????????????????????????????
????????????
????java.util?й???13?????????????????????????????б??????????????????Щ????????
????????
????HashSet?? ???HashMap????????????????????????????????????????????????Ч??????????????????HashMap??????????洢????????????????????????.
????TreeSet?? ???????????????????????????????ζ??????TreeSet??????????????????????????????TreeSet??????????TreeMap.
?????б??
????Vector?? ?????????????????????????????????????????????????????±?洢???????????????????????????????????????????????????????Vector?м???????Vector????????????!!?????????????????????????????????
????Stsck: ??????Vector???????????????????????????!??????????洢????
????LinkedList: ?????????????????????????????????????????????á?
????ArrayList: ?????????飬??????????????????????????????????????????Vector???????