Defined:
collection classes in Java: A tool class, like a container, that stores any number of objects with common attributes.
Role:
Collections can:
1, in the interior of the class, the data are organized;
2, simple and fast search large number of entries;
3, some set interface, provides a series of orderly elements, and can quickly insert or delete elements in the middle of the sequence;
4, some set interface, provides a mapping relationship, you can quickly find the corresponding unique object by keyword (key), and this keyword can be any type.
vs. Arrays:
1, the length of the array is fixed, the set length is variable;
2, the array can only access the elements through the following table, the following table type can only be numeric, and some collections can be any type to find the specific object being mapped.
Architecture of the Java Collection framework:
Collection interface
1, is the list, set and queue interface of the parent interface;
2, defines the method which can be used to manipulate list, set and queue--adding and deleting;
List interface and its implementation class--arraylist
- List (sequence), elements are ordered, and repeatable;
- The list can precisely control where the element is inserted, or delete the element at the specified position;
- arraylist--array sequence is an important implementation class of list;
- ArrayList the bottom layer is implemented by an array
The collection framework in Java