Package org.apache.commons.math3.stat
Class Frequency.NaturalComparator<T extends Comparable<T>>
java.lang.Object
org.apache.commons.math3.stat.Frequency.NaturalComparator<T>
- Type Parameters:
T
- the type of the objects compared
- All Implemented Interfaces:
Serializable
,Comparator<Comparable<T>>
- Enclosing class:
Frequency
private static class Frequency.NaturalComparator<T extends Comparable<T>>
extends Object
implements Comparator<Comparable<T>>, Serializable
A Comparator that compares comparable objects using the
natural order. Copied from Commons Collections ComparableComparator.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
Serializable version identifier -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
compare
(Comparable<T> o1, Comparable<T> o2) Compare the twoComparable
arguments.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
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerializable version identifier- See Also:
-
-
Constructor Details
-
NaturalComparator
private NaturalComparator()
-
-
Method Details
-
compare
Compare the twoComparable
arguments. This method is equivalent to:((
Comparable
)o1).compareTo
(o2)- Specified by:
compare
in interfaceComparator<T extends Comparable<T>>
- Parameters:
o1
- the first objecto2
- the second object- Returns:
- result of comparison
- Throws:
NullPointerException
- when o1 isnull
, or when((Comparable)o1).compareTo(o2)
doesClassCastException
- when o1 is not aComparable
, or when((Comparable)o1).compareTo(o2)
does
-