I\'ve got a Map (actually I\'m using a more complex POJO but simplifying it for the sake of my question)
Person looks
What about entrySet()
HashMap hm = new HashMap();
hm.put("A", new Person("p1"));
hm.put("B", new Person("p2"));
hm.put("C", new Person("p3"));
hm.put("D", new Person("p4"));
hm.put("E", new Person("p5"));
Set> set = hm.entrySet();
for (Map.Entry me : set) {
System.out.println("Key :"+me.getKey() +" Name : "+ me.getValue().getName()+"Age :"+me.getValue().getAge());
}