Interface Comparator<T1,​T2>

Type Parameters:
T1 - ,
T2 - the types to compare
All Known Implementing Classes:
InverseComparator

public interface Comparator<T1,​T2>
Used to compare two objects of a different or the same type.
See Also:
Comparators.registerComparator(Class, Class, Comparator), DefaultComparators
  • Field Details

    • equalsComparator

      static final Comparator<?,​?> equalsComparator
  • Method Details

    • compare

      Comparator.Relation compare(T1 o1, T2 o2)
      Compares the given objects which may not be null. Returning GREATER/SMALLER means that the first parameter is greater/smaller.
      Parameters:
      o1 - Non-null object
      o2 - Non-null object
      Returns:
      the relation of the objects. Should neither return GREATER_OR_EQUAL nor SMALLER_OR_EQUAL.
    • supportsOrdering

      boolean supportsOrdering()
      Returns:
      whether this comparator supports ordering of elements or not.