org.springframework.util.comparator

Class ComparableComparator<T extends java.lang.Comparable<T>>

  • java.lang.Object
    • org.springframework.util.comparator.ComparableComparator<T>
  • Type Parameters:
    T - the type of comparable objects that may be compared by this comparator
    All Implemented Interfaces:
    java.util.Comparator<T>


    public class ComparableComparator<T extends java.lang.Comparable<T>>
    extends java.lang.Object
    implements java.util.Comparator<T>
    Comparator that adapts Comparables to the Comparator interface. Mainly for internal use in other Comparators, when supposed to work on Comparables.
    Since:
    1.2.2
    Author:
    Keith Donald
    See Also:
    Comparable
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static ComparableComparator INSTANCE
      A shared instance of this default comparator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int compare(T o1, T o2) 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Constructor Detail

      • ComparableComparator

        public ComparableComparator()
    • Method Detail

      • compare

        public int compare(T o1,
                           T o2)
        Specified by:
        compare in interface java.util.Comparator<T extends java.lang.Comparable<T>>