Here you can find the source of mapToString(Map extends Object, ? extends Object> map)
Parameter | Description |
---|---|
map | The map to convert |
public static String mapToString(Map<? extends Object, ? extends Object> map)
//package com.java2s; //License from project: Open Source License import java.util.Map; public class Main { /**/*from ww w . java 2 s . co m*/ * Convert a map to a string representation (e.g: for toString()) * * @param map The map to convert * @return The string representation of the map */ public static String mapToString(Map<? extends Object, ? extends Object> map) { StringBuilder sb = new StringBuilder(); if (map == null || map.isEmpty()) { return sb.toString(); } for (Object key : map.keySet()) { sb.append(key.toString()); sb.append(" : "); sb.append(map.get(key).toString()); sb.append(" ; "); } return sb.toString(); } }