Java Collection Framework

Source: Internet
Author: User

Concept of the collection:

collection classes in Java: is a tool class, like a container, that stores objects with common attributes, with an unlimited number of

Function of the collection:

1. Within the class, organize the data
2. Simple and efficient search for large amounts of data
3. Some interfaces provide an ordered array of elements that can be quickly inserted or deleted in the sequence.
4. Some interfaces, provide a hungry mapping relationship, you can use the keyword (key) to quickly find the corresponding unique heap box, and this keyword can be any type

The difference between a collection class and an array:
The length of the array is fixed, and the length of the collection class is variable,
And in the array to query some elements can only be queried through the method of traversal, if the element to be processed is very complex, the program execution is very inefficient, but the collection can be found through the element mapping elements.

Two main interfaces of the collection framework: collection and map
Collection store a separate object, including 3 sub-interfaces: List (sequence), queue, set (set), where list and queue storage data is ordered and repeatable, Set is unordered and non-repeatable, List and set are more commonly used.
ArrayList array sequence: is a common implementation class under List;
LinkedList Chain list: is an important implementation class of queue, but also an implementation class of list;
HashSet Hash Set: is the implementation class of Set

Map provides a mapping relationship, which stores data internally with entry key-value pairs such as <Key,Value>, where key and value can be any type of object
HashMap Hash Table: is the implementation class of Map

ArrayList, HashSet, HashMap are the three implementation classes with the highest frequency.

Java Collection Framework

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.