+ 1
you can! If you want both the key and value at the same time in a loop then the following achieves it: HashMap<String, String> map = getHashMap(); for(Entry<String, String> entry : map.getEntrySet()) { String key = entry.getKey(); String value = entry.getValue(); // Do something }
17th Sep 2016, 5:04 PM
Greg Sims
Greg Sims - avatar