mark一下,有时间整理。之前没有注意,今天在mr中用这个取topN竟然效果更棒。
TreeMap
map.lastEntry() //获取到treeMap中的第一个Entry或者最后一个Entry
map.remove(map.firstKey()) //获取最后一个key
map.lastEntry().getValue() //获取最后一个key对应的的值
map.remove(map.firstKey() //倒叙
mark一下,有时间整理。之前没有注意,今天在mr中用这个取topN竟然效果更棒。
TreeMap
map.lastEntry() //获取到treeMap中的第一个Entry或者最后一个Entry
map.remove(map.firstKey()) //获取最后一个key
map.lastEntry().getValue() //获取最后一个key对应的的值
map.remove(map.firstKey() //倒叙