Java 数据结构与集合类(28页)Good is good, but better carries it.精益求精,善益求善。Java collections A collection allows a group of objects to be treated as a single unit. Arbitrary objects can be stored, retrieved and manipulated as elements of these collections. Collections Framework presents a set of standard utility classes to manage such collections.1. It contains ‘core interfaces’ which allow collections to be manipulated independent of their implementations. These interfaces define the common functionality exhibited by collections and facilitate data exchange between collections.2. A small set of implementations that are concrete implementations of the core interfaces, providing data structures that a program can use.3. An assortment of algorithms to perform various operations such as, sorting and searching. Collections framework is interface based, collections are implemented according to their interface type, rather than by implementation types. By using the interfaces whenever collections of objects need to be handled, interoperability and interchangeability are achieved. By convention each of the collection implementation classes provide a constructor to create a collection based on the elements in the Collection object passed as argument. By the same token, Map implementations provide a constructor that accepts a Map argument. This allows the implementation of a collection (Collection/Map) to be changed. But Collections and Maps are not interchangeable. Interfaces and their implementations in Java 1.2Collection||__ Set (no dupes, null allowed based on implementation) HashSet||||__ SortedSet (Ordered Set) TreeSet||__ List (ordered collection, dupes OK) Vector, ArrayList, LinkedList Map (key-value ...