Here you can find the source of printMap(Map
public static <K, V> void printMap(Map<K, V> map)
//package com.java2s; //License from project: Open Source License import java.util.Iterator; import java.util.Map; import java.util.Set; public class Main { public static <K, V> void printMap(Map<K, V> map) { Set<Map.Entry<K, V>> resultsEntry = map.entrySet(); Iterator<Map.Entry<K, V>> iter = resultsEntry.iterator(); while (iter.hasNext()) { Map.Entry<K, V> result = iter.next(); System.out.println(result.getKey() + " = " + result.getValue()); }//ww w . j av a 2 s. co m } }