Summary of Java Collections

Source: Internet
Author: User

The Java Collection Class is primarily responsible for saving and holding other data, so the collection class is also called the container class. The Java collection classes are divided into:Set: The order of elements is not distinguished, duplicate values are not allowed
list: Distinguishes the order of elements and allows duplicate values to occur
map: Use Key--values, do not allow duplicate keys, each key corresponds to a value
Java Collections can only hold data of reference types, which are references to objects
The collection interface describes the root interface of the set and list collection types The relationship between set and map . All the keys in the map collection are gathered together to form a set set. So the map collection provides a Set<k>keyset () method that returns a set of all key components. Thus, all the keys in the map collection have the characteristics of the set set, so long as the map has all the keys together, it is a set set, which enables the transformation of the map to set.

Related methods:Add () increase failure, return False if duplicate element is addedcontains () determines if an element is included
iterator () returns to an iterator
list provides precise control of where elements are inserted, and features such as element-indexed access to elements
Set (INDEX,ELEMETN) modifies the element under the specified index
View the contents of a map in the form of a map relationship set
put (objectkey,objectvalues) adds a new value
get (Objectkey) Find the value above key
Setkeyset () returns all keys to a set
collectionvalues () returns all values to a collection collection




From for notes (Wiz)

Summary of Java Collections

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.