Thursday 24 January 2013

How to iterate throught a Map

//Declare a map object
Map mapObj = new HashMap();
//iterate through the map objects elements one by one 
for (Map.Entry entry : mapObj.entrySet()) {

       System.out.println(entry.getKey() + ": " + entry.getValue());

    }

No comments:

Post a Comment