The collection framework includes collection, mapping, iterators, arrays, and some legacy (stack, hashtable, properties) and interface Dictionary, all legacy interfaces are synchronized, and all the set classes are not synchronized. of.
1. Collection class Collection is the top-level interface of all collections, the LIST interface, and the SET interface inherited from the Collection. The MAP interface does not inherit from Collection, but the Collection object can be obtained through the value () method. Collection can be converted to an array with toarray (). Collection can return an iterator that points to the collection via iTerator (). List uses the behavior of the collection into a sequence, uses the index starting from 0, can insert an element into the list or access an element in the list, and repeat the value. SET is not allowed to repeat the value. AbstractCollection provides basic implementation of Collection. AbstractList inherits from AbstractCollection to implement the List interface, and provide basic LIST implementation. AbstractSet inherits from AbstractCollection to implement the SET interface, and provide basic SET implementation. AbstractSequentialList Extend AbstractList to implement the order of collection elements. ArrayList inherits from AbstractList, implements a List interface, supports a dynamic array that requires growth, can be created with an initial length, automatically becomes large when the length exceeds, and automatically becomes smaller when deleted. However, the redistribution is a very time-consuming system operation, which can be improved by EnsureCapacity (int Capacity) to improve the capacity, where Capacity is the capacity to be reassigned. LinkedList inherits from AbstractSequentialList to implement a list. Hashset inherits from AbstractSet, creating a collection of a hash table storage element, ensuring that the execution time of the basic operation (Add, REMOVE, SIZE) or the like regardless of the collection, and the execution time of the basic operation (Add, Remove, Size) is constant. Treeset extension AbstractSet, realizes the ordered collection of trees; the elements in the collection are stored in ascending sequence; access and convenient speed is very fast, generally used to store large ordered data and quickly look up. LinkedHashSet inherits from hashSet, is a set of chains inserted with an element, and allows traversal collection in insertion order according to the element; when using an iterator to access the LinkedHashset collection, the element will return in the order of them.
2, mapping mapping is the object that stores keyword-value, can be checked to the value of his corresponding value by a given keyword; where the keywords and values can be object; the keyword must be unique, but the value is Duplicate; mapping is not a collection, does not implement a collection interface; however, you can get a collection of keywords through the keyset () method, or a collection of values via values (). The MAP interface is a top-level interface of all mappings. SortedMap interface extends the MAP interface to ensure that the value of the keyword is stored; AbstractMap provides basic MAP implementation, which is the parent class implemented by all mapping. HashMap uses the hash table to implement the MAP interface, which guarantees that the execution time of the basic operation (GET, PUT) is unchanged regardless of the collection; however, it cannot guarantee the order of the element; the capacity can be dynamically increased, and the growth rate can pass through the construction method HashMap. INT Capacity, Float Fillratio is set, where Fillratio is a growth rate. TreeMap provides a sequential storage value pair and allows for quick lookup, and ensures that the set elements are arranged in ascending parameters in keywords. LinkedHashMap Extended HashMap, maintains the elements linked list in the mapping according to the element's insertion sequence, and the elements will return in the order of their insertion. 3, array arrays provides many array processing methods that can be used to connect sets and arrays. AsList () returns a list of operators, lists, and array points to the same place. Sort () sort an array so that the array is finally arranged in ascending order. 4, legacy vector is synchronized, can grow, can be specified by vector (int size, int inCr), if no increment is specified, will be doubled each time the memory; Java2's Vector is implemented List interface, and provide support for iterators, you can use the vector as used by using List. Stack inherits from the vector and makes advanced stacks. Dictionary is a keyword-value for stored abstract classes, operations are similar to mapping, but now this class has been mapped. Hashtable is a subclass of Dictionary, but it is improved in Java2 and implements the MAP interface. It is similar to HashMap. It is that HashTable is synchronized. Hashmap is not synchronized; capacity can also be automatically increased, via HashTable (int size, float fixratio) Specify the fill rate, if not specified, the fill rate defaults to 0.75. Properties is a subclass of HashTable.