作者:丁木China | 来源:互联网 | 2022-12-14 17:10
I have a TreeMap and I want to compare its i
and i+1
value in it. How can I do that. I know that TreeMap is sorted based on its keys but I want to compare the values and can't use sorting as I will loose original form. I want something like this but in TreeMap-
我有一个TreeMap,我想比较它的i和i + 1值。我怎样才能做到这一点。我知道TreeMap是根据它的键进行排序的,但我想比较这些值,不能使用排序,因为我会松散原始形式。我希望这样的东西,但在TreeMap-
int a[] = new int[n];
for (int i = 0; i a[i + 1])
{
c++;
}
}
1 个解决方案