Here you can find the source of toString(Map
Parameter | Description |
---|---|
map | the Map whose string representation to return |
public static String toString(Map<String, String> map)
//package com.java2s; //License from project: Open Source License import java.util.Map; public class Main { /**//from w ww . jav a 2s .co m * Returns a string representation of the contents of the specified Map * The string representation consists of a list of the Map's entries, * enclosed in square brackets (<tt>"[]"</tt>). * Each entry is represented as <tt>key = value</tt> * * @param map the Map whose string representation to return * @return string representation of <tt>map</tt> */ public static String toString(Map<String, String> map) { StringBuilder string = new StringBuilder("["); for (Map.Entry<String, String> keyValue : map.entrySet()) { string.append(keyValue.getKey()).append(" = ").append(keyValue.getValue()).append(";"); } return string.append("]").toString(); } }