Home > Java > JavaBase > What collections are there in java

What collections are there in java

Release: 2019-11-21 14:35:33
Original
4226 people have browsed it

What collections are there in java

There are three main types of collections in Java: set (set), list (list) and map (mapping).

1. List (ordered, repeatable)

The objects stored in List are ordered and repeatable. List focuses on indexes. It has a series of index-related methods and the query speed is fast. Because when inserting or deleting data into the list collection, it will be accompanied by the movement of subsequent data, all insertion and deletion of data are slow.

2. Set (unordered, cannot be repeated)

The objects stored in Set are unordered and cannot be repeated. The objects in the set are not in a specific way. Sorting simply adds objects to a collection.

3. Map (key-value pairs, unique keys, non-unique values)

The Map collection stores key-value pairs. Keys cannot be repeated, but values ​​can be repeated. . Obtain the value according to the key. When traversing the map collection, first obtain the set collection of the key, traverse the set collection, and obtain the corresponding value.

For more java knowledge, please pay attention to java basic tutorial.

The above is the detailed content of What collections are there in java. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template