Java collection classes

Source: Internet
Author: User

list, set, and map are the three most important interfaces in this set system.      Where list and set inherit from the collection interface. Set does not allow elements to be duplicated.      HashSet and TreeSet are the two main implementation classes. The list is ordered and allows elements to be duplicated. ArrayList, LinkedList, and vectors are the three main implementation classes. The map also belongs to the collection system, but differs from the collection interface. A map is a collection of key pairs of value, where the key column is a collection. Key cannot be duplicated, but value can be repeated.      HashMap, TreeMap, and Hashtable are the three main implementation classes. The SortedSet and SortedMap interfaces sort the elements by the specified rules, sortedmap the key column. Vectors and hashtable are thread-synchronized (synchronized). In performance, ArrayList and HashMap are better than vectors and Hashtable, respectively. TD style= "Border-top-color: #cccccc; PADDING:8PX 5px; Vertical-align:top; Background-color: #f7f8fa; " >144 TD style= "Border-top-color: #cccccc; PADDING:8PX 5px; Vertical-align:top; Background-color: #f7f8fa; " >104 TD style= "Border-top-color: #cccccc; PADDING:8PX 5px; Vertical-align:top; " >o (n) TD style= "Border-top-color: #cccccc; PADDING:8PX 5px; Vertical-align:top; Background-color: #f7f8fa; " >88
Collection Performance Default Capacity space-Time size overhead of 10K entries set the size exactly? extension Algorithm
HashSet o (1) 16 X2
HashMap o (1) 16 128 360k no x2
Hashtable o (1) 11 X2+1
LinkedList 1 48 240k is +1
ArrayList o (n) 10 x1.5
StringBuffer O (1) 16 72 24 Whether X2

UML Empty Arrows solid lines are inherited, empty arrows dashed lines are implemented



From for notes (Wiz)



Java collection classes

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.