Home >Java >JavaBase >What is a collection in java

What is a collection in java

(*-*)浩
(*-*)浩Original
2019-11-11 13:22:024064browse

What is a collection in java

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

What is a collection in java

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to enter in javaNext article:How to enter in java