Java Foundation 35 Two-case set map and its common methods

Source: Internet
Author: User

A system of single-instance collections:

---------|CollectionRoot interface of a singleton collection
--------------|ListIf you implement the collection class for the list interface,Features: orderly, repeatableNote: Ordering in a collection does not refer to the natural order, but the order in which it is added is consistent with the order in which it comes out.
------------------|ArrayListThe ArrayList bottom maintains an object array implementation. (thread is not secure),Features: Fast query speed, and delete the slow speed. (orderly, repeatable)
------------------|LinkedListThe bottom of the LinkedList is implemented using a linked list structure,Features: Query speed is slow, adding and deleting faster. (orderly, repeatable)
------------------|Vector (Learn about it)The underlying is also the implementation of maintaining an object array, the implementation is the same as ArrayList, but the vector is thread-safe and operating inefficient
--------------|SetIf you implement a collection class for the set interface,Features: Unordered, non-repeatableNote: unordered in a collection does not refer to the natural order, but the order in which the elements are added is inconsistent with the order of the elements.
------------------|HashSetThe bottom layer is for a hash table to support,Features: storage speed block
------------------|TreeSetThe underlying is implemented using a red-black tree (binary tree) data structure that is not synchronized (that is, thread insecure) and cannot be shared among multiple threads, but can be synchronized using the Synchroinzedmap () method.feature: The elements are sorted by storage (in natural order)

Two-case Set system:

----------| Map If it is the implementation of the map interface collection class, has the characteristics: the stored data are in the form of key-value pairs exist, the key is not repeatable, the value can be repeated
--------------| HashMap
--------------| TreeMap
--------------| HashTable

Original Dshore

Author's homepage:http://www.cnblogs.com/dshore123/

Source:https://www.cnblogs.com/dshore123/p/9104169.html

Welcome reprint, reprint must explain the source. ( If this article is helpful to you, you can click on the lower right corner of the recommendation , or comments, thank you!) )

Java Foundation 35 Two-case set map and its common methods

Related Article

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.