TreeMap删除第一个倒叙输出

mark一下,有时间整理。之前没有注意,今天在mr中用这个取topN竟然效果更棒。

TreeMap

	map.lastEntry() //获取到treeMap中的第一个Entry或者最后一个Entry
	map.remove(map.firstKey())	//获取最后一个key
	map.lastEntry().getValue()	//获取最后一个key对应的的值
	map.remove(map.firstKey()	//倒叙






发布了131 篇原创文章 · 获赞 79 · 访问量 31万+

猜你喜欢

转载自blog.csdn.net/qq_31780525/article/details/79091506