Think in Java (14): Container in-depth study

Source: Internet
Author: User
1.HashSet set designed for quick Find
TreeSet the underlying tree structure, you must implement the comparable interface, and the deposited elements will be sorted according to the rules in the CompareTo method
Linkedhashset internally uses a linked list to maintain the insertion order of elements.

2.HASHMAP uses the object's Hashcode () for fast querying, and this method can significantly improve performance.
Linkedhashmap maintaining internal order using a linked list (insert order)
TreeMap based on the implementation of the red-black tree, the results are sorted (order determined by comparable)
Concurrenthashmap a thread-safe map

3. Why is HashMap query fast?
Because hashing is used internally: hashing makes the query fast. Use the Hashcode () method to generate a hash code

Think in Java (14): Container in-depth study

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.