Class StringTools.GenericStringComparator<T>

java.lang.Object
de.aristaflow.adept2.util.StringTools.GenericStringComparator<T>
Type Parameters:
T - The type of object which to compare by mapping them to strings.
All Implemented Interfaces:
Comparator<T>
Enclosing class:
StringTools

public static class StringTools.GenericStringComparator<T> extends Object implements Comparator<T>
A comparator for objects which are mapped and compared by appropriate strings. This includes null handling of the objects as well as the strings.

Note that this will only be serialisable if the toString function is serialisable.

  • Field Details

    • toString

      protected final Function<T,String> toString
      The function which maps an object to a string.
  • Constructor Details

    • GenericStringComparator

      public GenericStringComparator(Function<T,String> toString)
      Creates a new comparator for comparing objects mapped to strings.
      Parameters:
      toString - The function which maps an object to a string.
  • Method Details