public class ToStringComparator<T>
extends java.lang.Object
implements java.util.Comparator<T>, java.io.Serializable
Comparator
interface which uses
the result of the toString
method to compare the objects.
Ie. by using this comparator objects are sorted according to the
toString()
values.
Note: this comparator may impose orderings that are inconsistent with equals.
Modifier and Type | Field and Description |
---|---|
private boolean |
descending |
private static long |
serialVersionUID |
Constructor and Description |
---|
ToStringComparator(boolean descending)
Create a new comparator.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(T o1,
T o2) |
private static final long serialVersionUID
private final boolean descending