JAVA simple container classification and JAVA simple container classification
Figure:Commonly used containers are displayed in a purple rough box;
The dotted box indicates the interface, and the solid box indicates normal (specific class );
A dot line with a hollow arrow indicates that a specific class implements an interface;
A solid arrow indicates that a class can generate the object pointed to by the arrow.
Container usage summary:
1. Collection stores a single element, while Map stores the associated key-value pairs.
2. Like an array, the List also establishes a digital index and object Association. Therefore, arrays and lists are sorted containers. List can be automatically resized.
3. If you want to perform a large number of random access, use ArrayList. If you want to insert or delete elements from the middle of the table frequently, use explain list.
4. Map is a design that associates objects (rather than numbers) with objects. HashMap is designed for fast access. TreeMap keeps the "key" in the sorting state, so there is no HashMap fast. LinkedHashMap maintains the order of element insertion, but it also provides fast access through hash.
5. Set does not accept repeated elements. HashSet provides the fastest query speed, while TreeSet keeps elements in order.
LinkedHashSet stores elements in the insert sequence.