Here you can find the source of mapToString(String itemName, Map map)
private static String mapToString(String itemName, Map map)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { private static String mapToString(String itemName, Map map) { StringBuffer buffer = new StringBuffer("\n\t< " + itemName + " >\n"); Iterator iterator = map.keySet().iterator(); for (; iterator.hasNext();) { Object key = iterator.next(); Object value = map.get(key); buffer.append("\t\t< ").append(null == key ? "null" : key.toString()).append(" = ") .append(null == value ? "null" : value.toString()).append(" >\n"); }/*from w ww. j a v a 2 s .c om*/ buffer.append("\t< " + itemName + " >"); return buffer.toString(); } }