Here you can find the source of printMapStrings(Map
public static String printMapStrings(Map<String, List<String>> map, String mapDescription)
//package com.java2s; /* //from www .j ava2 s.c o m Copyright [2013-2014] eBay Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import java.util.List; import java.util.Map; import java.util.Map.Entry; public class Main { public static String printMapStrings(Map<String, List<String>> map, String mapDescription) { StringBuilder sb = new StringBuilder(); if (map == null) { return "Map " + mapDescription + " is NULL"; } sb.append("\nMAP_SUMMARY of " + mapDescription + " with key count:" + map.size()).append(" :\n["); for (String key : map.keySet()) { sb.append(key).append("\t"); } sb.append("]\n"); sb.append("\nMAP_START of " + mapDescription + " with key count:" + map.size()).append("\n"); for (Entry<String, List<String>> entry : map.entrySet()) { String key = entry.getKey(); List<String> list = entry.getValue(); sb.append("\nLIST_START of " + mapDescription + "[" + key + "] count:" + list.size()).append("\n[\n"); for (String s : list) { sb.append(s).append("\n"); } sb.append("]\nLIST_END: List of " + mapDescription + "[" + key + "] count:" + list.size()).append("\n"); } sb.append("MAP_END of " + mapDescription + " with key count:" + map.size()).append("\n"); return sb.toString(); } }