Here you can find the source of printMap(HashMap map)
public static void printMap(HashMap map)
//package com.java2s; /**/* w w w .j av a2 s. c o m*/ * @(#)StringUtil.java * * create by x_chenbiwu at 2008-3-7 * * Copyright 2008 fivemen,Inc. All rights reserved. * * fivemen proprietary/confidential.Use is subject to license terms */ import java.util.HashMap; public class Main { public static void printMap(HashMap map) { java.util.Iterator iterator = map.keySet().iterator(); Object key = null; Object obj = null; while (iterator.hasNext()) { key = iterator.next(); obj = map.get(key); System.out.println("key:" + key + " value:" + obj); } } }