Java examples for java.util:Map Operation
print Hash Map to String
//package com.java2s; import java.util.Map; import java.util.Set; public class Main { public static String printHashMap(Map<?, ?> inSet) { if (inSet == null) { return "null"; }/*from ww w. j a v a2s . c o m*/ StringBuilder sb = new StringBuilder("[ "); Set<?> keys = inSet.keySet(); for (Object key : keys) { sb.append("(key=").append(key).append(", value=") .append(inSet.get(key)).append(") "); } sb.append("]"); return sb.toString(); } }