Map Iteration

By | October 25th 2019 08:53:41 PM | viewed 42 times

The followings method can use for map iteration:

Map map = new HashMap<>();

map.forEach((key, value) -> System.out.println("[Key] : " + key + " [Value] : " + value));
    for (Map.Entry entry : map.entrySet()) {
		System.out.println("[Key] : " + entry.getKey() + " [Value] : " + entry.getValue());
	}
   Iterator iter = map.entrySet().iterator();
	while (iter.hasNext()) {
		Map.Entry entry = (Map.Entry) iter.next();
		System.out.println("[Key] : " + entry.getKey() + " [Value] : " + entry.getValue());
	}
	

bONEandALL
Visitor

Total : 9222

Today :7

Today Visit Country :

  • United States