Map Iteration

By | October 25th 2019 08:53:41 PM | viewed 211 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 : 19501

Today :36

Today Visit Country :

  • United States
  • Germany
  • United Kingdom
  • India
  • Switzerland
  • Singapore
  • The Netherlands
  • Russia