我刚刚将此功能添加到了Guava,有关Javadoc
,请参见此处。
编辑 :
Multisets.copyHighestCountFirst()根据原始问题的用法示例:
Multiset<DeviceType> histogram = getDeviceStats();for (DeviceType type : Multisets.copyHighestCountFirst(histogram).elementSet()) { System.out.println(type + ": " + histogram.count(type));}


