Java tutorial
//package com.java2s; import java.util.Iterator; import java.util.Map.Entry; import java.util.Map; public class Main { public static final <K, V> void printM(Map<K, V> map, String sep) { Iterator<Entry<K, V>> it = map.entrySet().iterator(); while (it.hasNext()) { Entry<K, V> e = it.next(); System.out.append(e.getKey().toString()).append("::").append(e.getValue().toString()); if (it.hasNext()) { System.out.append(sep); } } } }