The overall architecture of the Java collection

Source: Internet
Author: User

Summary of the Java collection Framework

JavaCollection isJava provides a toolkit that contains commonly used data structures: collections, linked lists, queues, stacks, arrays, mappings, and so on. Javathe Collection Toolkit location isjava.util.*
JavaThe collection can be divided mainly into4sections:Listlist,SetCollection,Mapmappings, tool classes(Iteratoriterators,Enumerationenumeration classes,Arraysand thecollections).

Java Collection Toolkit Framework diagram ( below ):

General Description:

look at the frame chart above, first grab its trunk, i.e. 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 two major branches :

  List ordered queue , each element has its index. The index value of the first element is 0 list linkedlist, ArrayList, Vector, Stack

  (Set is a collection that is not allowed to have duplicate elements. set hastset and hashset depends on hashmap It's actually through hashmap treeset depends on treemap treemap

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

Abstractmapis an abstract class that implements theMapmost of the interfacesAPI. andHashMap,TreeMap,Weakhashmapare inherited fromAbstractmap. Although Hashtable inherits from dictionary, it implements the map interface. Next, look atIterator. It is a tool for iterating over collections, that is, we usuallyIteratoriterator to iterate through the collection. We sayCollectionrelies onIterator, is becauseCollectionimplementation classes are implemented.iterator ()function (collection inherits the Itrable interface) and returns aIteratorobject. Listiteratoris specifically for traversingListand the existence of. Look againEnumeration, it isJDK 1.0the abstract class introduced. Role andIteratoras well as traversing the collection;Enumerationis more powerful thanIteratorless. In the block diagram above,Enumerationonly inHashtable, Vector, Stackused in the.

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

Reference: http://www.cnblogs.com/skywang12345/p/3308498.html

The overall architecture of the Java collection

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.