List, Set, Map common class difference and contact __ Set

Source: Internet
Author: User
List
Ordered collection allow repeating elements
Allow null elements ArrayList
Ordered collection (implemented internally through arrays) allows repeating elements to allow null elements to be unsynchronized Vector
Ordered collection (implemented internally through arrays) allows repeating elements to allow null element synchronization LinkedList
Ordered collection (implemented internally through a two-way linked list) allows repeating elements to allow null elements to be asynchronous
Set
Contains a maximum of one null element
Collection that do not contain duplicate elements (more specifically, set does not contain elements that meet e1.equals (E2) to E1 and E2)
HashSet
Contains a maximum of one null element that does not contain duplicate elements (more specifically, the set does not contain e1.equals (E2) elements to E1 and E2) does not guarantee the iteration of the set (especially if it does not guarantee that the order is immutable) collection Linkedhashset
Contains a maximum of one null element that does not contain a repeating element collection (more specifically, the set does not contain a predictable iterative order of elements that satisfy e1.equals (E2) for E1 and E2 (maintains a doubly linked list running on all entries, which defines the sequence of iterations, i.e. Not synchronized according to the order in which elements are inserted into set TreeSet
Collection that contains null elements that do not contain duplicate elements is not allowed (or rather, the set does not contain e1.equals (E2) elements to sort the natural order of E1 and E2) unsynchronized
Map
Key value pairs
HashMap
Allows NULL to be used as a value or key (except for unsynchronized and allow Nulls, the HashMap class is roughly the same as Hashtable.) does not guarantee the order of the mappings, especially if it does not guarantee that the order is constant and asynchronous Linkedhashmap
Allows NULL to be used as a value or key with predictable iteration order (maintains a doubly linked list of all entries that defines the sequence of iterations that is usually the order in which the keys are inserted into the map) not synchronized Concurrenthashmap
It is not allowed to use NULL as a key or value to guarantee the order of the mappings, especially because it does not guarantee that the order is immutable. The expected adjustable concurrent hash table synchronization (barrel lock Lock) for fully concurrent and updated support obtained TreeMap
Only NULL is allowed as a value, but it is not allowed to be sorted as a key in natural order (based on the navigablemap implementation of the red-black tree) asynchronous Hashtable
Null is not allowed as a value or a key does not guarantee the sequential synchronization of mappings (entire hash table lock)

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.