Java Collection Collection&map

Source: Internet
Author: User

Map<k,v> is a key-value pair, K-the type of the key that this map maintains, and the type of V-map value. The key value is one by one corresponding to the relationship;

Collection is only the key, and the underlying is also a key-value pair, but the type of the value is hidden.

Collection

The list can be placed in duplicate elements, set inside can not put repeating elements.

1, ArrayList bottom is implemented by the array, LinkedList is implemented by the list, the base of the vector is also implemented with an array.
2, HashSet bottom is the hashing algorithm implementation, TreeSet bottom is to use the binary tree implementation, Linkedhashset bottom is to use linked list to achieve.

Map

1, HashMap Bottom is the hash algorithm implementation, TREEMAP is implemented with a binary tree, Hashtable bottom is the hash algorithm, linkedhashmap the bottom is a linked list to achieve.

Vector, Hashtable is thread-safe;

ArrayList, LinkedList, HashSet, TreeSet, HashMap, TreeMap, and Linkedhashmap are thread insecure.

Java Collection Collection&map

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.