import java.util.*;
public class Test {
public static void main(String[] args) {
String str = "aaaaaaaaaaaaaaaaabaadddccefqdffbaeba";
Set
Map
for (Character c : str.toCharArray()) {
int i = 1;
if (!sets.add(c)) {
i = map.get(c);
i++;
}
map.put(c, i);
}
List
map.entrySet());
Collections.sort(orderList,
new Comparator
public int compare(Map.Entry
Map.Entry
return (o1.getValue() - o2.getValue());
}
});//重写排序方法
String result="";
for (Map.Entry
result+=entry.getKey()+":"+entry.getValue()+",";
}
if(result.length()>0)
result=result.substring(0, result.length()-1);
System.out.println(result);
}
}