资源描述:
《Java数据结构与集合类》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、Javacollections•Acollectionallowsagroupofobjectstobetreatedasasingleunit.Arbitraryobjectscanbestored,retrievedandmanipulatedaselementsofthesecollections・•CollectionsFrameworkpresentsasetofstandardutilityclassestomanagesuchcollections・1・Itcontains'coreinterfaces'whichallowcollectionstobemanipulatedi
2、ndependentoftheirimplementations.Theseinterfacesdefinethecommonfunctionalityexhibitedbycollectionsandfacilitatedataexchangebetweencollections・2.Asmallsetofimplementationsthatareconcreteimplementationsofthecoreinterfaces,providingdatastructuresthataprogramcanuse・3.Anassortmentofalgorithmstoperformva
3、riousoperationssuchas,sortingandsearching・•Collectionsframeworkisinterfacebased,collectionsareimplementedaccordingtotheirinterfacetype,ratherthanbyimplementationtypes・Byusingtheinterfaceswhenevercollectionsofobjectsneedtobehandied,interoperabilityandinterchangeabilityareachieved・•Byconventioneachof
4、thecollectionimplementationclassesprovideaconstructortocreateacollectionbasedontheelementsintheCollectionobjectpassedasargument.Bythesametoken,MapimplementationsprovideaconstructorthatacceptsaMapargument.Thisallowstheimplementationofacollection(Collection/Map)tobechanged・ButCollectionsandMapsarenot
5、interchangeable•InterfacesandtheirimplementationsinJava1.2CollectionI
6、_Set(nodupes,nullallowedbasedonimplementation)HashSetII
7、
8、—SortedSet(OrderedSet)TreeSetI
9、—List(orderedcollection,dupesOK)Vector,ArrayList,LinkedListMap(key-valuepairs,nullallowedbasedonimplementation)HashTable,HashMap
10、—SortedMap(O
11、rderedMap)TreeMapInterfaceDescriptionCollectionAbasicinterfacethatdefinestheoperationsthatalltheclassesthatmaintaincollectionsofobjectstypicallyimplement.SetExtendsCollection,setsthatmaintainuniqueelements.SetinterfaceisdefinedintermsoftheequalsoperationSortedSetExtendsSet.maintaintheelementsinasor
12、tedorderListExtendsCollection,maintainelementsinasequentialorder,duplicatesallowed.MapAbasicinterfacethatdefinesoperationsthatclassesthatrepresentmappingsofkeystovaluestypicallyimplementSortedMapExtendsMapf