Map to string
import java.util.Iterator; import java.util.Map; import java.util.Set; public class Util{ public static String dump(Map map) { if (map == null) return "null"; StringBuffer buf = new StringBuffer().append('{'); Set keys = map.keySet(); Iterator iterator = keys.iterator(); Object key; Object value; boolean first = true; while (iterator.hasNext()) { if (first) first = false; else buf.append(','); key = iterator.next(); value = map.get(key); buf.append( key + "->" + value ); } buf.append('}'); return buf.toString(); } }