Here you can find the source of toString(Map, ?> map)
Parameter | Description |
---|---|
map | a parameter |
public static String toString(Map<?, ?> map)
//package com.java2s; //License from project: Apache License import java.util.Iterator; import java.util.Map; public class Main { /**//from w ww . j a va 2 s . c o m * * @param map * @return */ public static String toString(Map<?, ?> map) { if (map == null || map.size() == 0) { return "{ }"; } StringBuffer sb = new StringBuffer(); sb.append("{"); Iterator it = map.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); sb.append(entry.getKey()); sb.append(":"); sb.append(entry.getValue()); if (it.hasNext()) { sb.append(","); } } sb.append("}"); return sb.toString(); } }