Top Description Constructors Methods
org.springframework.util.comparator

public abstract Class Comparators

extends Object
Class Inheritance
Imports
java.util.Comparator

Convenient entry point with generically typed factory methods for common Spring Comparator variants.
Author
Juergen Hoeller
Since
5.0

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static <T> Comparator<T>
comparable()

Return a Comparable adapter.

public static <T> Comparator<T>
nullsHigh()

Return a Comparable adapter which accepts null values and sorts them higher than non-null values.

public static <T> Comparator<T>
nullsHigh(Comparator<T> comparator)

Return a decorator for the given comparator which accepts null values and sorts them higher than non-null values.

public static <T> Comparator<T>
nullsLow()

Return a Comparable adapter which accepts null values and sorts them lower than non-null values.

public static <T> Comparator<T>
nullsLow(Comparator<T> comparator)

Return a decorator for the given comparator which accepts null values and sorts them lower than non-null values.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Comparatorsback to summary
public Comparators()

Method Detail

comparableback to summary
public static <T> Comparator<T> comparable()

Return a Comparable adapter.

Annotations
@SuppressWarnings:unchecked
See Also
Comparator#naturalOrder()
nullsHighback to summary
public static <T> Comparator<T> nullsHigh()

Return a Comparable adapter which accepts null values and sorts them higher than non-null values.

See Also
Comparator#nullsLast(Comparator)
nullsHighback to summary
public static <T> Comparator<T> nullsHigh(Comparator<T> comparator)

Return a decorator for the given comparator which accepts null values and sorts them higher than non-null values.

See Also
Comparator#nullsLast(Comparator)
nullsLowback to summary
public static <T> Comparator<T> nullsLow()

Return a Comparable adapter which accepts null values and sorts them lower than non-null values.

See Also
Comparator#nullsFirst(Comparator)
nullsLowback to summary
public static <T> Comparator<T> nullsLow(Comparator<T> comparator)

Return a decorator for the given comparator which accepts null values and sorts them lower than non-null values.

See Also
Comparator#nullsFirst(Comparator)