【发布时间】:2019-04-23 07:24:30
【问题描述】:
有没有办法在这个收集器中按值对地图进行排序而不创建新的流? 现在它打印:AAS:5 ABA:195 ABC:12 ABE:52。 所需:ABA:195 ABE:52 ... getTrigraphStream(path) 返回:HOW THE TRA GRI ONC GRI ONC INS WHE INS WHE
public Map<String, Long> getTrigraphStatisticsMapAlphabet(String path) {
return getTrigraphStream(path)
.collect(groupingByConcurrent(Function.identity(),
ConcurrentSkipListMap::new, counting()));
}
【问题讨论】:
标签: sorting java-8 java-stream counting collectors