Here you can find the source of printMap(HashMap
protected static void printMap(HashMap<String, List<String>> listHashMap)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { protected static void printMap(HashMap<String, List<String>> listHashMap) { for (String s : listHashMap.keySet()) { System.out.print(s + ": ["); for (String n : listHashMap.get(s)) { System.out.print(n + " "); }/*from w w w. j a v a2 s . c o m*/ System.out.print("]\n"); } } protected static void print(HashMap<String, Integer> m) { System.out.println("HashMap:"); for (Map.Entry<String, Integer> e : m.entrySet()) { System.out.println(" " + e.getKey() + ":" + e.getValue()); } } protected static void print(Set<String> s) { System.out.println("Set:"); for (String str : s) { System.out.println(" " + str); } } }