Get value data sorted by key in map

Source: Internet
Author: User

The item you are doing today encounters the value data that gets sorted by key in the map, and what is saved in key is the string type. Map of the knowledge point for a long time useless a little rusty, do not know how to use. Looking at the map of the previous colleague's code based on key, it was found that he first took the key out to encapsulate it in a list, then sorted the list by the Collections.sort method, and removed the value order in order to add to a new list. Feel this way of cycle too much, so the internet to find can directly sort of method, see someone write directly saved to TreeMap in the data can be implemented according to the function of sorting. So the experiment was a bit. The output looks so sure.

Get value data sorted by key in 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.