T
- The type of object to use with this comparator.@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class ReverseComparator<T> extends java.lang.Object implements java.util.Comparator<T>, java.io.Serializable
Comparator
object that may
be used to iterate through values in what would normally be considered
reverse order.Constructor and Description |
---|
ReverseComparator()
Creates a new comparator that will sort items in reverse order.
|
ReverseComparator(java.util.Comparator<T> baseComparator)
Creates a new comparator that will sort items in the reverse order that
they would be normally sorted using the given comparator.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(T o1,
T o2)
Compares the provided objects to determine their relative order in a
sorted list.
|
boolean |
equals(java.lang.Object o)
Indicates whether the provided object may be considered equal to this
comparator.
|
int |
hashCode()
Retrieves a hash code for this class.
|
public ReverseComparator()
Comparable
interface.public ReverseComparator(@NotNull java.util.Comparator<T> baseComparator)
baseComparator
- The base comparator that will be used to make the
determination.public int compare(@NotNull T o1, @NotNull T o2)
compare
in interface java.util.Comparator<T>
o1
- The first object to compare.o2
- The second object to compare.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(@Nullable java.lang.Object o)
equals
in interface java.util.Comparator<T>
equals
in class java.lang.Object
o
- The object for which to make the determination.true
if the provided object may be considered equal to
this comparator, or false
if not.