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.Iterator; import java.util.Map; public class Main { public static String mapToString(Map map) { if (map == null) { return null; }//from w w w . j a v a 2 s .c o m StringBuffer sBuffer = new StringBuffer(); Iterator keys = map.keySet().iterator(); while (keys.hasNext()) { Object key = keys.next(); sBuffer.append("\n").append(key).append(" = ").append(map.get(key)); } return sBuffer.toString(); } }