org.apache.directory.shared.ldap.schema
Class ComparableComparator
java.lang.Object
org.apache.directory.shared.ldap.schema.ComparableComparator
- All Implemented Interfaces:
- Serializable, Comparator
public class ComparableComparator
- extends Object
- implements Comparator, Serializable
Compares two objects taking into account that one might be a Comparable.
- Version:
- $Rev: 434411 $
- Author:
- Apache Directory Project
- See Also:
- Serialized Form
Method Summary |
int |
compare(Object o1,
Object o2)
Compares two objects taking into account that one may be a Comparable. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ComparableComparator
public ComparableComparator()
compare
public int compare(Object o1,
Object o2)
- Compares two objects taking into account that one may be a Comparable. If
the first is a comparable then its compareTo operation is called and the
result returned as is. If the first is not a Comparable but the second is
then its compareTo method is called and the result is returned after
being negated. If none are comparables the hashCode of o1 minus the
hashCode of o2 is returned.
- Specified by:
compare
in interface Comparator
- See Also:
Comparator.compare(Object, Object)
Copyright © 2004-2012. All Rights Reserved.