Concept of the collection:
collection classes in Java: is a tool class, like a container, that stores objects with common attributes, with an unlimited number of
Function of the collection:
1. Within the class, organize the data
2. Simple and efficient search for large amounts of data
3. Some interfaces provide an ordered array of elements that can be quickly inserted or deleted in the sequence.
4. Some interfaces, provide a hungry mapping relationship, you can use the keyword (key) to quickly find the corresponding unique heap box, and this keyword can be any type
The difference between a collection class and an array:
The length of the array is fixed, and the length of the collection class is variable,
And in the array to query some elements can only be queried through the method of traversal, if the element to be processed is very complex, the program execution is very inefficient, but the collection can be found through the element mapping elements.
Two main interfaces of the collection framework: collection and map
Collection store a separate object, including 3 sub-interfaces: List (sequence), queue, set (set), where list and queue storage data is ordered and repeatable, Set is unordered and non-repeatable, List and set are more commonly used.
ArrayList array sequence: is a common implementation class under List;
LinkedList Chain list: is an important implementation class of queue, but also an implementation class of list;
HashSet Hash Set: is the implementation class of Set
Map provides a mapping relationship, which stores data internally with entry key-value pairs such as <Key,Value>, where key and value can be any type of object
HashMap Hash Table: is the implementation class of Map
ArrayList, HashSet, HashMap are the three implementation classes with the highest frequency.
Java Collection Framework