mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
!1 NullComparator 比较器bug修复
* 1. 当使用 new PropertyComparator("endTime", false) 时,把null值放到最后,不生效
This commit is contained in:
parent
9b81e5502d
commit
3c13da5515
@ -53,7 +53,7 @@ public class FuncComparator<T> extends NullComparator<T> {
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
private int compare(T o1, T o2, Comparable v1, Comparable v2) {
|
||||
int result = ObjectUtil.compare(v1, v2);
|
||||
int result = ObjectUtil.compare(v1, v2, this.nullGreater);
|
||||
if (0 == result) {
|
||||
//避免TreeSet / TreeMap 过滤掉排序字段相同但是对象不相同的情况
|
||||
result = CompareUtil.compare(o1, o2, this.nullGreater);
|
||||
|
@ -51,11 +51,6 @@ public class NullComparator<T> implements Comparator<T>, Serializable {
|
||||
return new NullComparator<>(nullGreater, comparator == null ? other : comparator.thenComparing(other));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparator<T> reversed() {
|
||||
return new NullComparator<>((false == nullGreater), comparator == null ? null : comparator.reversed());
|
||||
}
|
||||
|
||||
/**
|
||||
* 不检查{@code null}的比较方法<br>
|
||||
* 用户可自行重写此方法自定义比较方式
|
||||
|
Loading…
Reference in New Issue
Block a user