jdsl.core.ref
Class IntegerComparator
java.lang.Object
jdsl.core.ref.AbstractComparator
jdsl.core.ref.IntegerComparator
- All Implemented Interfaces:
- Comparator, EqualityComparator
- public class IntegerComparator
- extends AbstractComparator
- implements Comparator
Compares java.lang.Integers.
- Version:
- JDSL 2.1.1
- Author:
- Benoit Hudson (bh), Luca Vismara (lv)
Method Summary |
int |
compare(Object x1,
Object x2)
A C-style comparison function that returns a negative value if the
first object is less than the second, a positive value if the second
object is less, and 0 if the two objects are equal. |
boolean |
isComparable(Object o)
Allows a container (or any client) to find out whether an object is
a member of the ordered set over which this comparator is defined. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IntegerComparator
public IntegerComparator()
compare
public int compare(Object x1,
Object x2)
throws ClassCastException
- Description copied from interface:
Comparator
- A C-style comparison function that returns a negative value if the
first object is less than the second, a positive value if the second
object is less, and 0 if the two objects are equal.
- Specified by:
compare
in interface Comparator
- Specified by:
compare
in class AbstractComparator
- Returns:
- a negative value if x1 < x2, zero if x1 == x2, and a
positive value if x1 > x2
- Throws:
ClassCastException
isComparable
public boolean isComparable(Object o)
- Description copied from interface:
EqualityComparator
- Allows a container (or any client) to find out whether an object is
a member of the ordered set over which this comparator is defined.
- Specified by:
isComparable
in interface EqualityComparator
- Parameters:
o
- Object you propose to compare with this comparator
- Returns:
- Whether o is a non-null java.lang.Integer