java.lang.Object | |
↳ | org.apache.commons.collections.comparators.BooleanComparator |
A Comparator for Boolean objects that can sort either true or false first.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a
BooleanComparator that sorts
false values before true values. | |||||||||||
Creates a
BooleanComparator that sorts
trueFirst values before
!trueFirst values. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Compares two arbitrary Objects.
| |||||||||||
Returns
true iff that Object is
is a Comparator whose ordering is known to be
equivalent to mine. | |||||||||||
Returns a BooleanComparator instance that sorts
trueFirst values before
!trueFirst values. | |||||||||||
Returns a BooleanComparator instance that sorts
false values before true values. | |||||||||||
Returns a BooleanComparator instance that sorts
true values before false values. | |||||||||||
Implement a hash code for this comparator that is consistent with
equals . | |||||||||||
Returns
true iff
I sort true values before
false values. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.util.Comparator
|
Creates a BooleanComparator
that sorts
false
values before true
values.
Equivalent to BooleanComparator(false)
.
Please use the static factory instead whenever possible.
Creates a BooleanComparator
that sorts
trueFirst
values before
!trueFirst
values.
Please use the static factories instead whenever possible.
trueFirst | when true , sort
true boolean values before false
|
---|
Compares two arbitrary Objects.
When both arguments are Boolean
, this method is equivalent to
compare((Boolean)obj1,(Boolean)obj2)
.
When either argument is not a Boolean
, this methods throws
a ClassCastException
.
obj1 | the first object to compare |
---|---|
obj2 | the second object to compare |
ClassCastException | when either argument is not Boolean
|
---|
Compares two non-null
Boolean
objects
according to the value of sortsTrueFirst()
.
b1 | the first boolean to compare |
---|---|
b2 | the second boolean to compare |
NullPointerException | when either argument null
|
---|
Returns true
iff that Object is
is a Comparator
whose ordering is known to be
equivalent to mine.
This implementation returns true
iff that
is a BooleanComparator
whose value of sortsTrueFirst()
is equal to mine.
object | the object to compare to |
---|
Returns a BooleanComparator instance that sorts
trueFirst
values before
!trueFirst
values.
trueFirst | when true , sort
true Boolean s before false |
---|
Returns a BooleanComparator instance that sorts
false
values before true
values.
Returns a BooleanComparator instance that sorts
true
values before false
values.
Implement a hash code for this comparator that is consistent with
equals
.
Returns true
iff
I sort true
values before
false
values. In other words,
returns true
iff
compare(Boolean.FALSE,Boolean.TRUE)
returns a positive value.