Class Comparators

java.lang.Object
io.vavr.collection.Comparators

final class Comparators extends Object
INTERNAL: Common Comparator related functions (not intended to be public).
  • Constructor Details

    • Comparators

      private Comparators()
  • Method Details

    • naturalComparator

      static <U> Comparator<U> naturalComparator()
      Returns the natural comparator for type U, i.e. treating it as Comparable<U>. The returned comparator is also java.io.Serializable.

      Please note that this will lead to runtime exceptions, if U is not Comparable.

      Type Parameters:
      U - The type
      Returns:
      The natural Comparator of type U