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
Post a Comment