Package 

Class ComparatorContract

    • Method Summary

      Modifier and Type Method Description
      static <T> void testComparator(T least1, T middle1, T greatest1, Comparator<T> comparator) Tests the various properties the Comparable contract is supposed to uphold.
      • Methods inherited from class java.lang.Object

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

      • testComparator

         static <T> void testComparator(T least1, T middle1, T greatest1, Comparator<T> comparator)

        Tests the various properties the Comparable contract is supposed to uphold. Also tests that the behavior of compareTo() is compatible with equals() and hashCode() which is strongly suggested, but not actually required. Write your own test if you don't want that. Expects three unique objects. The first must be less than the second, which in turn is less than the third. See note in class documentation.