org.springframework.util.comparator

Class Comparators

  • java.lang.Object
    • org.springframework.util.comparator.Comparators


  • public abstract class Comparators
    extends java.lang.Object
    Convenient entry point with generically typed factory methods for common Spring Comparator variants.
    Since:
    5.0
    Author:
    Juergen Hoeller
    • Constructor Summary

      Constructors 
      Constructor and Description
      Comparators() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static <T> java.util.Comparator<T> comparable()
      Return a Comparable adapter.
      static <T> java.util.Comparator<T> nullsHigh()
      Return a Comparable adapter which accepts null values and sorts them higher than non-null values.
      static <T> java.util.Comparator<T> nullsHigh(java.util.Comparator<T> comparator)
      Return a decorator for the given comparator which accepts null values and sorts them higher than non-null values.
      static <T> java.util.Comparator<T> nullsLow()
      Return a Comparable adapter which accepts null values and sorts them lower than non-null values.
      static <T> java.util.Comparator<T> nullsLow(java.util.Comparator<T> comparator)
      Return a decorator for the given comparator which accepts null values and sorts them lower than non-null values.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Comparators

        public Comparators()
    • Method Detail

      • nullsLow

        public static <T> java.util.Comparator<T> nullsLow()
        Return a Comparable adapter which accepts null values and sorts them lower than non-null values.
        See Also:
        NullSafeComparator.NULLS_LOW
      • nullsLow

        public static <T> java.util.Comparator<T> nullsLow(java.util.Comparator<T> comparator)
        Return a decorator for the given comparator which accepts null values and sorts them lower than non-null values.
        See Also:
        NullSafeComparator.NullSafeComparator(boolean)
      • nullsHigh

        public static <T> java.util.Comparator<T> nullsHigh()
        Return a Comparable adapter which accepts null values and sorts them higher than non-null values.
        See Also:
        NullSafeComparator.NULLS_HIGH
      • nullsHigh

        public static <T> java.util.Comparator<T> nullsHigh(java.util.Comparator<T> comparator)
        Return a decorator for the given comparator which accepts null values and sorts them higher than non-null values.
        See Also:
        NullSafeComparator.NullSafeComparator(boolean)