org.apache.commons.math3.stat
Class Frequency.NaturalComparator<T extends Comparable<T>>
java.lang.Object
org.apache.commons.math3.stat.Frequency.NaturalComparator<T>
- 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 |
private static long |
serialVersionUID
Serializable version identifier |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- Serializable version identifier
- See Also:
- Constant Field Values
Frequency.NaturalComparator
private Frequency.NaturalComparator()
compare
public int compare(Comparable<T> o1,
Comparable<T> o2)
- Compare the two
Comparable
arguments.
This method is equivalent to:
((Comparable
)o1).compareTo
(o2)
- Specified by:
compare
in interface Comparator<Comparable<T extends Comparable<T>>>
- Parameters:
o1
- the first objecto2
- the second object
- Returns:
- result of comparison
- Throws:
NullPointerException
- when o1 is null
,
or when ((Comparable)o1).compareTo(o2)
does
ClassCastException
- when o1 is not a Comparable
,
or when ((Comparable)o1).compareTo(o2)
does
Copyright (c) 2003-2013 Apache Software Foundation