Here you can find the source of mapToString(Map map)
public static String mapToString(Map map)
//package com.java2s; //License from project: Apache License import java.util.Map; import java.util.Map.Entry; public class Main { public static String mapToString(Map map) { if (map == null) return "null"; if (map.size() == 0) return "empty"; StringBuilder sb = new StringBuilder(); sb.append("{"); for (Object o : map.entrySet()) { Map.Entry me = (Entry) o; sb.append(me.getKey()).append(": ").append(me.getValue()).append(","); }/*from w ww .j a v a 2 s.c o m*/ sb.append("}"); return sb.toString(); } }