Comparator for Boolean objects that can sort either
true or false first.
getTrueFirstComparator(), getFalseFirstComparator(), booleanComparator(boolean)
| Modifier and Type | Field and Description |
|---|---|
| private static final BooleanComparator | FALSE_FIRST
Constant "false first" reference. |
| private static final long | serialVersionUID
Serialization version. |
| private static final BooleanComparator | TRUE_FIRST
Constant "true first" reference. |
| private boolean | trueFirst
|
| Access | Constructor and Description |
|---|---|
| public | |
| public | BooleanComparator(final boolean
when trueFirst)true, sort
true boolean values before falseCreates a |
| Modifier and Type | Method and Description |
|---|---|
| public static BooleanComparator | Returns: a singleton BooleanComparator instancewhen trueFirst)true, sort
true Booleans before falseReturns a BooleanComparator instance that sorts
|
| public int | Returns: negative if obj1 is less, positive if greater, zero if equalthe first boolean to compare b1, final Boolean the second boolean to compare b2)Implements java. null Boolean objects
according to the value of sortsTrueFirst().
|
| public boolean | Returns: true if equalthe object to compare to object)Overrides java. Implements java. true iff that Object is
is a Comparator whose ordering is known to be
equivalent to mine.
|
| public static BooleanComparator | Returns: the false first singleton BooleanComparatorReturns a BooleanComparator instance that sorts
|
| public static BooleanComparator | Returns: the true first singleton BooleanComparatorReturns a BooleanComparator instance that sorts
|
| public int | Returns: a hash code for this comparator.Overrides java. equals.
|
| public boolean |
| FALSE_FIRST | back to summary |
|---|---|
| private static final BooleanComparator FALSE_FIRST Constant "false first" reference. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serialization version. | |
| TRUE_FIRST | back to summary |
|---|---|
| private static final BooleanComparator TRUE_FIRST Constant "true first" reference. | |
| trueFirst | back to summary |
|---|---|
| private boolean trueFirst
| |
| BooleanComparator | back to summary |
|---|---|
| public BooleanComparator() Creates a
Equivalent to Please use the static factory instead whenever possible. | |
| BooleanComparator | back to summary |
|---|---|
| public BooleanComparator(final boolean trueFirst) Creates a Please use the static factories instead whenever possible.
| |
| booleanComparator | back to summary |
|---|---|
| public static BooleanComparator booleanComparator(final boolean trueFirst) Returns a BooleanComparator instance that sorts
Clients are encouraged to use the value returned from this method instead of constructing a new instance to reduce allocation and garbage collection overhead when multiple BooleanComparators may be used in the same virtual machine.
| |
| compare | back to summary |
|---|---|
| public int compare(final Boolean b1, final Boolean b2) Implements java. Compares two non-
| |
| equals | back to summary |
|---|---|
| public boolean equals(final Object object) Overrides java. Implements java. Returns
This implementation returns | |
| getFalseFirstComparator | back to summary |
|---|---|
| public static BooleanComparator getFalseFirstComparator() Returns a BooleanComparator instance that sorts
Clients are encouraged to use the value returned from this method instead of constructing a new instance to reduce allocation and garbage collection overhead when multiple BooleanComparators may be used in the same virtual machine.
| |
| getTrueFirstComparator | back to summary |
|---|---|
| public static BooleanComparator getTrueFirstComparator() Returns a BooleanComparator instance that sorts
Clients are encouraged to use the value returned from this method instead of constructing a new instance to reduce allocation and garbage collection overhead when multiple BooleanComparators may be used in the same virtual machine.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Implement a hash code for this comparator that is consistent with
| |
| sortsTrueFirst | back to summary |
|---|---|
| public boolean sortsTrueFirst() Returns
| |