Here you can find the source of toString(Map
public static String toString(Map<String, String[]> arg)
//package com.java2s; //License from project: Apache License import java.util.Arrays; import java.util.Map; import java.util.Map.Entry; import java.util.Set; public class Main { public static String toString(Map<String, String[]> arg) { String str = null;/*from w ww .j a va 2 s . c o m*/ if (arg != null) { StringBuffer sb = new StringBuffer(); sb.append("{"); Set<Entry<String, String[]>> entries = arg.entrySet(); for (Entry<String, String[]> entry : entries) { String key = entry.getKey(); String val = Arrays.toString(entry.getValue()); sb.append(key + "=" + val + ", "); } int len = sb.length(); if (sb.charAt(len - 1) == ' ') { sb.delete(len - 2, len); } sb.append("}"); str = sb.toString(); } return str; } public static String toString(Object[] objects) { if (objects == null) { return null; } return Arrays.toString(objects); } public static String toString(Object object) { if (object == null) { return null; } return object.toString(); } }