A collection base for Java

Source: Internet
Author: User

Collection concept of the collection: (Factor group length is fixed dead, use inconvenient so introduce set)

In Java programming, things that are used to load other kinds of objects (reference types) are called containers.

Arrays are containers, and collections are containers, and containers have collection--interfaces in Java.

Collection is the most basic set interface, and a collection represents a set of object, the collection element (Elements). Java The SDK does not provide classes that inherit directly from collection, and theJava SDK provides classes that are "subinterfaces" such as list and set that inherit from collection.
All classes that implement the collection interface must provide two standard constructors: a parameterless constructor is used to create an empty collection, and a constructor with a collection parameter is used to create a new collection. This new collection has the same elements as the incoming collection. The latter constructor allows the user to copy a collection.

Collection interface:

There are also three interfaces under the interface: Set, list, and map

Nothing in the SAT interface is ordered, one is saved and one cannot be repeated.

The contents of the list interface are ordered, one to save and one to repeat.

A map is a key-value pair that is saved in two. A key, one as a value, can be used to find one of his values.

There are two classes of implementations for each:

The set interface has HashSet and TreeSet implementation classes.

The list interface has ArrayList and LinkedList implementation classes.

The map interface has HASHMAP and TREEMAP implementation classes.

A collection base for Java

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.