Try this:
var HashMap = java.util.HashMap;
var populatedMap = new HashMap();
populatedMap.put(123, 'OneTwoThree');
populatedMap.put(456, 'FourFiveSix');
var entryArray = populatedMap.entrySet().toArray();
for (var i=0; i < entryArray.length; i++) {
var entry = entryArray[i];
qie.debug('The key=' + entry.getKey() + ' with value=' + entry.getValue());
}
Note the highlighted code to get the entrySet and the use of length vs size. The same type of declaration will also work for the keySet and values collections of a map.
See this link for another option using an iterator: http://stackoverflow.com/questions/3479146/importing-a-map-in-javax-scripting-javascript-environment