Java Collections Remember Tricks

Source: Internet
Author: User

Jdk12. The common subclass objects in the set frame that appear later, the law of existence

The prefix name is the data structure name, the suffix name is the system name

ArrayList: Array structure. When you see the array, you know that the query is fast and that you can see the list again. can be deleted and changed to check

LinkedList: Linked list structure, add and delete fast Xxxfirast Xxxlast method New message: Get remove

HashSet: Hash table structure queries faster. It comes to mind that elements must overwrite hashcode and equals. Not guaranteed to be orderly. If you see set, you know you can't repeat.

Linkedhashset: Linked list + hash table. Can be ordered, because there are linked lists

TreeSet: Two fork tree, can be sorted. There are two ways to compare: One is the natural sort comaprarble, the other is the comparator comaparator

Java Collections Remember Tricks

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.