Java tutorial
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static String mapToString(Map<? extends Object, ? extends Object> map) { if (map == null) return "null"; StringBuilder sb = new StringBuilder(); for (Map.Entry<? extends Object, ? extends Object> entry : map.entrySet()) { Object key = entry.getKey(); Object val = entry.getValue(); sb.append(key).append("="); if (val == null) sb.append("null"); else sb.append(val); sb.append("\n"); } return sb.toString(); } }