gpt4 book ai didi

java - 如何从头到尾遍历 TreeMap

转载 作者:行者123 更新时间:2023-11-29 07:47:51 25 4
gpt4 key购买 nike

<分区>

我需要遍历 TreeMap<Integer, T> map从头到尾。怎么做?


我已经尝试过与下面发布的主题中的答案相同的事情:

new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return o2.intValue() - o1.intValue();
}
}

但这不是解决方案,那只是颠倒了顺序。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com