Java tutorial
//package com.java2s; import java.util.Map; import java.util.Set; public class Main { public static String getChartsType1(Map<String, Long> map) { String DATA = ""; if (map.isEmpty()) { return null; } Set<String> keySet = map.keySet(); for (String title : keySet) { Long long1 = map.get(title); DATA += "{value:" + long1 + ",name:'" + title + "'},"; } DATA = DATA.substring(0, DATA.length() - 1); return "[" + DATA + "]"; } }