The collection framework in Java

Source: Internet
Author: User

Defined:

collection classes in Java: A tool class, like a container, that stores any number of objects with common attributes.

Role:

Collections can:

1, in the interior of the class, the data are organized;

2, simple and fast search large number of entries;

3, some set interface, provides a series of orderly elements, and can quickly insert or delete elements in the middle of the sequence;

4, some set interface, provides a mapping relationship, you can quickly find the corresponding unique object by keyword (key), and this keyword can be any type.

vs. Arrays:

1, the length of the array is fixed, the set length is variable;

2, the array can only access the elements through the following table, the following table type can only be numeric, and some collections can be any type to find the specific object being mapped.

Architecture of the Java Collection framework:

Collection interface

1, is the list, set and queue interface of the parent interface;

2, defines the method which can be used to manipulate list, set and queue--adding and deleting;

List interface and its implementation class--arraylist

    • List (sequence), elements are ordered, and repeatable;
    • The list can precisely control where the element is inserted, or delete the element at the specified position;
    • arraylist--array sequence is an important implementation class of list;
    • ArrayList the bottom layer is implemented by an array

The collection framework in 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.