Here you can find the source of printHash(HashMap
public static void printHash(HashMap<String, Integer> hashMap)
//package com.java2s; //License from project: Apache License import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; public class Main { /**//from w ww .ja v a2 s .c om * HashMap Operations * */ public static void printHash(HashMap<String, Integer> hashMap) { System.out.println("Print HashMap"); Set s = hashMap.entrySet(); Iterator it = s.iterator(); while (it.hasNext()) { Map.Entry m = (Map.Entry) it.next(); System.out.println(m.getKey() + "\t" + m.getValue()); } } }