Here you can find the source of mapToString(Map
public static String mapToString(Map<String, String> map)
//package com.java2s; //License from project: Apache License import java.util.Map; public class Main { public static String mapToString(Map<String, String> map) { StringBuffer buf = new StringBuffer(); for (String key : map.keySet()) { buf.append(key).append('='); if (map.containsKey(key)) { buf.append(map.get(key)); }//from w w w .java 2s .c om buf.append("\n"); } return buf.toString(); } }