1、 The origin of set
Why don’t we use arrays to store objects? Because the array length is fixed, and we are often uncertain about the number of objects. So we have a collection framework, which is used to store objects.
1. The difference between collection and array
A: The length of the collection is variable. The basic data type value cannot be stored in the collection, only objects can be stored.
B: The length of the array is fixed and can store objects and basic data types.
When and which?
The length is not fixed, use set.
Fixed length, can be set, available array.
2、Architecture of collections
Because each container has a different data structure, there are many kinds of containers in our collection framework. At this time, we continue to extract the container upward, and finally form a collection architecture.
Our general habit of learning system is: first learn the top object, then use the bottom object.