Java tutorial
//package com.java2s; import java.util.Map; public class Main { private static String getStringOfClassList(Map<String, Integer> classes) { String result = ""; for (String className : classes.keySet()) { Integer occurences = classes.get(className); if (!result.isEmpty()) result += ", "; result += className + ": " + occurences; } return result; } }