1. Definition: A collection is a container that is designed to store objects
What are the differences between arrays and collections?
A: Length Difference
Fixed length of array
Variable Set length
B: Different content
Arrays store elements of the same type
Collections can store different types of elements
C: Data type issues for elements
Arrays can store basic data types, or they can store reference data types
Collection can only store reference types
2. Inheritance architecture for collections
Because of the different requirements, Java provides different collection classes. The data structure of the multiple collection classes is different, but they are all to provide storage and traversal functionality,
We extract the generality of them continuously, and finally form a set of inheritance architecture diagram.
Collection
|--list
|--arraylist
|--vector
|--linkedlist
|--set
|--hashset
|--treeset
Java Learning Notes---collection