Class 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.
    • Field Detail

      • toString

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

      • 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.