Hashmap requires more attention to the implementation of hashmap treemap for two implementation methods for obtaining key values.

Source: Internet
Author: User

1. Obtain the key value and then use the key to find the value.

Hashmap map = new hashmap ();

Set set = map. keyset ();

 

For (iterator it = set. iterator; it. hasnext ()){

String key = it. Next ();

String value = (string) map. Get (key );

 

}

 

 

2. directly obtain the set, that is, the ing table of key and value.

 

 

Hashmap Hm = new hashmap ();

Set set = hm. entryset ();

 

For (iterator it = set. iterator; it. hasnext ()){

Map. Entry set = it. Next ();

String key = set. getkey ();

String value = set. getvalue ();

 

}

------------------------------------------------

Hashmap treemap hashset treeset arraylist

 

How can I sort data in a treemap value?

Put treemap in collections and rewrite comparet in collections. Sort ().

Http://topic.csdn.net/u/20110621/18/DB4E6E64-DA20-4933-8FA3-3B5A870D71FF.html

 

What is the difference between treemap and hashmap? The listarray in the set is similar to the array,

 

Http://topic.csdn.net/u/20100313/10/5AB3E998-EFF7-43A4-ACDF-45B7948BBB8F.html

 

What is the difference between treeset and treemap? How should I use it (for example, it is best)

Both implementations are red and black trees. Serching algorithm is the same. The difference is the actual use.

Http://topic.csdn.net/t/20030627/15/1965094.html

 

Directly override the comparator when constructing a treemap.

Http://topic.csdn.net/u/20100806/14/992BEAC8-EDB2-4763-BF3A-5DB85A2D7283.html

 

Sort the specified key values of treemap

Http://topic.csdn.net/u/20100902/19/3782ADBC-F90B-4EDE-A7B6-4CB53D5DA2C3.html

 

Confusion about map. Entry

I am confused when I first came into contact with hashmap and treemap today.

Http://topic.csdn.net/u/20110214/20/4AAC8350-3DBD-45E7-9CA6-BEAF9AD37D87.html

 

 

Some cases of treemap sorting

Http://topic.csdn.net/u/20110827/19/13FA4BA6-0F5A-4CE0-91FA-9F2382510DEE.html

 

Http://topic.csdn.net/u/20091116/11/04D2945A-622B-41F0-870C-E52EACDFABC5.html

 

Http://topic.csdn.net/u/20091024/22/3A2D9513-CB1E-47CF-A637-AA4C56548EB4.html

 

 

Processing of hashmap with large data volume

Http://topic.csdn.net/u/20110127/00/F910D6DD-46BA-4FB9-AF61-62FEEFB9C595.html

Hash map does not support one-to-multiple processing.

Http://topic.csdn.net/u/20100703/16/DD047D2F-6E15-4199-986F-2560FF5EABAA.html

 

Interface Definition map hashtable

Http://topic.csdn.net/u/20100420/18/90C44B7C-BA8C-410F-8AD3-43C303E1F88E.html

 

An error is reported during running because Initialization is not performed.

Http://topic.csdn.net/u/20070111/15/D683A439-BEA3-4699-B10E-2B6533FFF45F.html

 

 

Huoguolong album

Http://topic.csdn.net/u/20080401/16/17589A77-F1BF-49B3-A494-10063A8CF59A.html

String for Server Load balancer

Http://topic.csdn.net/u/20080719/15/163A2C24-40C5-4216-94DC-E581A3A7312B.html

 

Hashmap sorting

 

Http://topic.csdn.net/u/20080531/17/158772EB-E31D-4152-AFEA-09731C473E12.html

 

Http://topic.csdn.net/u/20100626/15/B6F63628-D28C-47F4-9013-31AA27C8640F.html

 

Put two changes

 

Http://topic.csdn.net/u/20100118/11/3CE7F00A-7674-45F8-B528-AACE368F1745.html

 

A wonderful discussion about hashmap and size. His complexity is the O (1) bipartite query of Lon 2 N.

Http://topic.csdn.net/u/20110127/00/F910D6DD-46BA-4FB9-AF61-62FEEFB9C595.html

Http://topic.csdn.net/u/20100624/09/C8EB0AEE-2374-4967-A489-C73416ADA6DC.html

Http://topic.csdn.net/u/20070603/08/8ED3657B-F2C5-4AE7-A65C-326CEC4FA47E.html

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.