Java tutorial
//package com.java2s; import java.util.Map; import java.util.Set; public class Main { public static String printHashMap(Map<?, ?> inSet) { if (inSet == null) { return "null"; } StringBuilder sb = new StringBuilder("[ "); Set<?> keys = inSet.keySet(); for (Object key : keys) { sb.append("(key=").append(key).append(", value=").append(inSet.get(key)).append(") "); } sb.append("]"); return sb.toString(); } }