java中有几种常用的数据结构,主要分为Collection和map两个主要接口(接口只提供方法,并不提供实现),而程序中最终使用的数据结构是继承自这些接口的数据结构类。其主要的关系(继承关系)有:(----详细参见javaapi文档!)
Collection----CollectionsMap-----SortedMap------TreeMap
Collection----List-----(Vector\ArryList\LinkedList)Map------HashMap
Collection----Set------(HashSet\LinkedHashSet\SortedSet)
--------------Collection----------------1、CollectionsAPI----Thisclassconsistsexclusivelyofstaticmethodsthatoperateonorreturncollections.Itcontainspolymorphicalgorithmsthatoperateoncollections,"wrappers",whichreturnanewcollectionbackedbyaspecifiedcollection,andafewotheroddsandends.
ThemethodsofthisclassallthrowaNullPointerExceptionifthecollectionsorclassobjectsprovidedtothemarenull.
2、ListAPI----Thisclassconsistsexclusivelyofstaticmethodsthatoperateonorreturncollections.Itcontainspolymorphicalgorithmsthatoperateoncollections,"wrappers",whichreturnanewcollectionbackedbyaspecifiedcollection,andafewotheroddsandends.
ThemethodsofthisclassallthrowaNullPointerExceptionifthecollectionsorclassobjectsprovidedtothemarenull.
List是有序的Collection,使用此接口能够精确的控制每个元素插入的位置。用户能够使用索引(元素在List中的位置,类似于数组下标)来访问List中的元素,这类似于Java的数组。
3、VectorAPI----TheVectorclassimplementsagrowablearrayofobjects.Likeanarray,itcontains北京中科医院骗人白癜风名医送健康