| java.lang.Object org.apache.commons.collections.comparators.ComparableComparator
compare | public int compare(Object obj1, Object obj2)(Code) | | Compare the two
Comparable Comparable arguments.
This method is equivalent to:
((Comparable)obj1).compareTo(obj2)
Parameters: obj1 - the first object to compare Parameters: obj2 - the second object to compare negative if obj1 is less, positive if greater, zero if equal throws: NullPointerException - when obj1 is null , or when ((Comparable)obj1).compareTo(obj2) does throws: ClassCastException - when obj1 is not a Comparable ,or when ((Comparable)obj1).compareTo(obj2) does |
equals | public boolean equals(Object object)(Code) | | Returns true iff that Object is
is a
Comparator Comparator whose ordering is
known to be equivalent to mine.
This implementation returns true
iff object.
Object.getClass getClass()
equals this.getClass() .
Subclasses may want to override this behavior to remain consistent
with the
Comparator.equals(Object) contract.
Parameters: object - the object to compare with true if equal since: Commons Collections 3.0 |
getInstance | public static ComparableComparator getInstance()(Code) | | Gets the singleton instance of a ComparableComparator.
Developers are encouraged to use the comparator returned from this method
instead of constructing a new instance to reduce allocation and GC overhead
when multiple comparable comparators may be used in the same VM.
the singleton ComparableComparator |
hashCode | public int hashCode()(Code) | | Implement a hash code for this comparator that is consistent with
ComparableComparator.equals(Object) equals .
a hash code for this comparator. since: Commons Collections 3.0 |
|
|