open class NullSafeComparator<T : Any> : Comparator<T>
A Comparator that will safely compare nulls to be lower or higher than other objects. Can decorate a given Comparator or work on Comparables.
Author
Keith Donald
Author
Juergen Hoeller
Since
1.2.2
See Also
Comparable
NullSafeComparator(comparator: Comparator<T>, nullsLow: Boolean)
Create a NullSafeComparator that sorts When comparing two non-null objects, the specified Comparator will be used. The given underlying Comparator must be able to handle the elements that this Comparator will be applied to. |
static val NULLS_HIGH: NullSafeComparator<Any>
A shared default instance of this comparator, treating nulls higher than non-null objects. |
|
static val NULLS_LOW: NullSafeComparator<Any>
A shared default instance of this comparator, treating nulls lower than non-null objects. |
open fun compare(o1: T, o2: T): Int |
|
open fun equals(other: Any?): Boolean |
|
open fun hashCode(): Int |
|
open fun toString(): String |