The collection interface is the root of the collection interface tree and defines a common API for collection operations. The function is to facilitate the programmer to handle a set of common elements.
Note: object[] ToArray (object[] a): Returns an array containing all the elements of the collection. Implements the conversion between the collection class and the group class, generally if the specified array length is not enough, the system will automatically generate a new array to hold these elements, if the length is too large, the extra place will be assigned to NULL. Therefore, if it is not the operator, the array returned by this function should not be performed. Lenght operations, because that would result in inaccurate data.
Also, the function returns an array of the same run-time type as the specified type (a). That is, if a implements polymorphism, its run-time type should be the type of the instance created, not the reference type.
Set interface:
is a collection subinterface and cannot contain duplicate elements. The set interface does not introduce a new method, that is, all of its methods inherit the method from the parent class collection. There are three practical classes in set: Hashset,treeset,linkedset.
List interface:
Collection sub-interfaces, which allow duplicate elements, are ordered . There are also three practical classes: Arraylist,linkedlist,vector.
Queue interface:
A collection of data that is waiting to be processed, in which the elements are generally in the FIFO (first-in, out) order, as well as the precedence sequence that sorts the values of the elements.
Map interface:
The mapping used to implement the key value to the value. That is, an instance that implements the map interface, contains two elements, one for the key value, one for the value, and one for the key, which is the mapping. Also, the key value is unique. Map has Hashmap,hashtable,treemap, and Weekhashmap and other classes.
SortedSet Interface:
is a special set interface, which is also ordered. The SortedSet interface provides an access method for the view (subset) of the set interface and its ends (that is, the head and tail). The element added to the SortedSet implementation class must implement the comparable interface, otherwise it must provide an implementation of the comparable interface to its constructor. The TreeSet class is its only implementation.
SortedMap Interface:
is a special map interface used to keep the keys in order . The rest is treated the same as sortedset. TreeMap is the only implementation of it.
Collection Class: Collection interface and its sub-interfaces (basic knowledge popularization)