mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
修复IndexedComparator导致的数据错乱问题(ExcelWriter使用部分别名导致字段丢失)
This commit is contained in:
@@ -46,6 +46,16 @@ public class IndexedComparator<T> implements Comparator<T> {
|
||||
final int index1 = getOrder(o1);
|
||||
final int index2 = getOrder(o2);
|
||||
|
||||
if (index1 == index2) {
|
||||
if (index1 < 0 || index1 == this.array.length) {
|
||||
// 任意一个元素不在列表中, 返回原顺序
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 位置一样,认为是同一个元素
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Integer.compare(index1, index2);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user