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
public static class StringTools.GenericStringComparator<T> extends Object implements Comparator<T>
A comparator for objects which are mapped and compared by appropriate strings. This includesnull
handling of the objects as well as the strings.Note that this will only be serialisable if the
toString
function is serialisable.
-
-
Constructor Summary
Constructors Constructor Description GenericStringComparator(Function<T,String> toString)
Creates a new comparator for comparing objects mapped to strings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(T o1, T o2)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Method Detail
-
compare
public int compare(T o1, T o2)
- Specified by:
compare
in interfaceComparator<T>
-
-