java - Looping through the keys of a hashMap -


i have hashmap called africanpeople

private hashmap<integer, object> africanpeople = new hashmap<integer, object>(); 

the key age , value person object.

i want loop through hashmaps keys , people between age of 30 , 45.

is possible?

it possible, using

for (integer key : map.keyset()) 

but hashmap not appropriate structure this. should use treemap instead, can directly return submap containing keys between 30 , 45:


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -