T
- 被比较的对象public class FuncComparator<T> extends NullComparator<T>
comparator, nullGreater
Constructor and Description |
---|
FuncComparator(boolean nullGreater,
boolean compareSelf,
Function<T,Comparable<?>> func)
构造
|
FuncComparator(boolean nullGreater,
Function<T,Comparable<?>> func)
构造
|
compare, doCompare, thenComparing
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public FuncComparator(boolean nullGreater, Function<T,Comparable<?>> func)
nullGreater
- 是否null
在后func
- 比较项获取函数,此函数根据传入的一个对象,生成对应的可比较对象,然后根据这个返回值比较public FuncComparator(boolean nullGreater, boolean compareSelf, Function<T,Comparable<?>> func)
nullGreater
- 是否null
在后compareSelf
- 在字段值相同情况下,是否比较对象本身。
如果此项为false
,字段值比较后为0会导致对象被认为相同,可能导致被去重。func
- 比较项获取函数Copyright © 2024. All rights reserved.