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

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -