public final class DefaultComparator extends Object implements Comparator<Comparable<Object>>
java.util.Comparator
implementation for
objects that implement java.lang.Comparable
interface.RangeConstraint
,
PropertyComparisonConstraint
Modifier and Type | Field and Description |
---|---|
static DefaultComparator |
INSTANCE
DefaultComparator single instance. |
Modifier and Type | Method and Description |
---|---|
int |
compare(Comparable<Object> o1,
Comparable<Object> o2)
Compares two
java.lang.Comparable objects. |
static <V> Comparator<V> |
getInstance(Class<V> type,
Class<? extends Comparator<?>> comparatorType)
Returns comparator for the specified object type and comparator type.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public static final DefaultComparator INSTANCE
DefaultComparator
single instance.public int compare(Comparable<Object> o1, Comparable<Object> o2)
java.lang.Comparable
objects.compare
in interface Comparator<Comparable<Object>>
o1
- The first object to be compared.o2
- The second object to be compared.public static <V> Comparator<V> getInstance(Class<V> type, Class<? extends Comparator<?>> comparatorType)
V
- The value type.type
- Type of the objects to be compared.comparatorType
- Type of the comparator.UnsupportedOperationException
- if the specified comparator is not
applicable to the specified object type.IllegalArgumentException
- if comparator instantiation fails.Copyright © 2011–2020 FoxLabs. All rights reserved.