One of the Java Collections (framework introduction)

Source: Internet
Author: User

This article was reproduced from: http://www.cnblogs.com/skywang12345/p/3308498.html

the Java collection can be divided into 4 parts: list lists, set sets, map mappings, tool classes (iterator Iterators, enumeration enumeration classes, arrays, and collections).

General Description:

First grab its trunk, collection and map.

1 collection is an interface that is a highly abstracted collection that contains the basic operations and properties of a collection .

The collection contains the list and set of the two major branches.
The list is an ordered queue, and each element has its index . The index value of the first element is 0.
the list implementation class has LinkedList, ArrayList, Vector, Stack.

Set is a collection that does not allow repeating elements .
The implementation class for set has Hastset and TreeSet. HashSet relies on HashMap, which is actually implemented through HashMap; TreeSet relies on treemap, which is actually implemented by TreeMap .

2 map is a mapping interface, which is a Key-value key-value pair . Each element in the map contains "one key" and "key corresponding to value".

Abstractmap is an abstract class that implements most of the APIs in the map interface. and Hashmap,treemap,weakhashmap are inherited from Abstractmap.
Although Hashtable inherits from dictionary, it implements the map interface.

Next, look at Iterator. It is a tool for iterating through a collection, that is, we usually traverse the collection through the iterator iterator. We say that collection relies on iterator because the collection implementation class implements the iterator () function and returns a iterator object.
Listiterator is specifically designed to traverse the list.

look again at enumeration, which is the abstract class introduced by JDK 1.0. Functions, like iterator, also traverse collections, but enumeration are less powerful than iterator. In the above block diagram, enumeration can only be used in Hashtable, Vector, and Stack .

Finally, look at arrays and collections. These are the two tool classes that manipulate arrays and collections .

With the overall framework above, we then analyze each class separately.

One of the Java Collections (framework introduction)

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.