Package de.aristaflow.adept2.util
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
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGenericStringComparator(Function<T, String> toString) Creates a new comparator for comparing objects mapped to strings. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
toString
The function which maps an object to a string.
-
-
Constructor Details
-
GenericStringComparator
Creates a new comparator for comparing objects mapped to strings.- Parameters:
toString- The function which maps an object to a string.
-
-
Method Details
-
compare
- Specified by:
comparein interfaceComparator<T>
-