The implementation details of the Java collection of the programmer's basic skills

Source: Internet
Author: User

1.Set Collections and Maps

Careful comparison of the above set and map under the interface name, it is not difficult to find that they are so similar, there must be a reason

If you only look at the map key will find that they can not be repeated, there is no order, that is, the map of all the key together is a set set, so map has a method set<k> keySet ();

For a map, in fact, he's the equivalent of a set set of all the elements that are key-value.

Question: How to implement a map with set??

Idea: Define a Simpleentry class that represents a Key-value pair, which can be used as a map when the elements in the set set are Simpleentry, so that the set

Not to be continued ....

The implementation details of the Java collection of the programmer's basic skills

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.