Java tutorial
//package com.java2s; import java.util.Iterator; import java.util.Map; public class Main { public static <K, V> String toString(Map<K, V> paramMap) { if (paramMap == null) return ""; if (paramMap.isEmpty()) return "{}"; StringBuilder localStringBuilder = new StringBuilder(); Iterator localIterator = paramMap.entrySet().iterator(); while (localIterator.hasNext()) { Map.Entry localEntry = (Map.Entry) localIterator.next(); Object[] arrayOfObject = new Object[2]; arrayOfObject[0] = localEntry.getKey().toString(); arrayOfObject[1] = localEntry.getValue().toString(); localStringBuilder.append(String.format(", %s -> %s ", arrayOfObject)); } return "{" + localStringBuilder.substring(1) + "}"; } }