!964 NullComparator 比较器bug修复

Merge pull request !964 from 想长大的笨小孩/v5-master
This commit is contained in:
Looly 2023-03-25 20:59:27 +00:00 committed by Gitee
commit 953fc7b18f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 1 additions and 6 deletions

View File

@ -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);

View File

@ -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>
* 用户可自行重写此方法自定义比较方式