Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Iterator; import java.util.Map; public class Main { /** line separator. */ private static final String LINE_SEPARATOR = System.lineSeparator(); public static String takeFromIntMap(final Map<String, Integer> pMap, final String dataSeparator) { String gotKey = ""; Iterator<String> innerIter; final StringBuffer tempBuf = new StringBuffer(); innerIter = pMap.keySet().iterator(); while (innerIter.hasNext()) { gotKey = innerIter.next(); tempBuf.append(gotKey + dataSeparator + pMap.get(gotKey).toString() + LINE_SEPARATOR); } return tempBuf.toString(); } }