The collection class is stored in the java.util package.
There are three main types of collections: set (set), list (list) and map (mapping). (Recommended study: java course)
Collections store references to objects, not the objects themselves. So we call the objects in the collection the references to the objects in the collection.
#To put it simply: a collection is a container for data, to be precise, it is a container for data object references.
Main structure diagram of Java collection framework
From the analysis of the diagram:
1. Collections are mainly divided into two interfaces: Collection and Map.
2. Collection is inherited by List and Set respectively.
3. List is implemented by AbstractList, and then Divided into 3 subclasses, ArrayList, LinkList and Vector
4. Set is implemented by AbstractSet, which is further divided into 2 subclasses, HashSet and TreeSet
5. Map is implemented by AbstractMap, which is further divided into 2 subclasses, HashMap and TreeMap
6. Map is implemented by Hashtable
The above is the detailed content of What is a collection in java. For more information, please follow other related articles on the PHP Chinese website!