com.sciapp.comparators
Class BooleanComparator
java.lang.Object
com.sciapp.comparators.BooleanComparator
- All Implemented Interfaces:
- Serializable, Comparator
public class BooleanComparator
- extends Object
- implements Comparator, Serializable
BooleanComparator is used to compare two Boolean objects
since the Boolean
class does not implement
the Comparable interface.
- See Also:
- Serialized Form
Method Summary |
int |
compare(Object o1,
Object o2)
Compares its two arguments for order as defined by compare of the
Comparator interface. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BooleanComparator
public BooleanComparator()
compare
public int compare(Object o1,
Object o2)
- Compares its two arguments for order as defined by
compare
of the
Comparator
interface. o1
and o2
must be of
Boolean type otherwise this method throws a ClassCastException.
This method returns:
a negative integer, if o1 is true and o2 is false
a positive integer, if o1 is false and o2 is true
zero, if o1 and o2 have the same boolean value (both true or both false).
- Specified by:
compare
in interface Comparator
- Parameters:
o1
- the first object to be compared.o2
- the second object to be compared.
- Returns:
- a negative integer, zero or a positive integer as described above.