Here you can find the source of mapToString(Map extends Object, ? extends Object> map)
public static String mapToString(Map<? extends Object, ? extends Object> map)
//package com.java2s; //License from project: Open Source License import java.util.Collection; import java.util.Map; public class Main { public static String mapToString(Map<? extends Object, ? extends Object> map) { String mapString = map.toString(); return mapString.substring(1, mapString.length() - 1); }//from w w w . j a v a 2s. co m public static <T extends Object> String toString(Collection<T> collection) { StringBuilder sb = new StringBuilder(); if (collection.size() == 0) { return ""; } for (T object : collection) { sb.append(object.toString()); sb.append(","); } return sb.substring(0, sb.length() - 1); } public static <T extends Object> String toString(Collection<T> collection, String delim) { StringBuilder sb = new StringBuilder(); if (collection.size() == 0) { return ""; } for (T object : collection) { sb.append(object.toString()); sb.append(delim); } return sb.substring(0, sb.length() - 1); } }