| java.lang.Object org.apache.commons.collections.comparators.BooleanComparator
Constructor Summary | |
public | BooleanComparator() Creates a BooleanComparator that sorts
false values before true values. | public | BooleanComparator(boolean trueFirst) Creates a BooleanComparator that sorts
trueFirst values before
!trueFirst values. |
BooleanComparator | public BooleanComparator()(Code) | | Creates a BooleanComparator that sorts
false values before true values.
Equivalent to
BooleanComparator.BooleanComparator(boolean) BooleanComparator(false) .
Please use the static factory instead whenever possible.
|
BooleanComparator | public BooleanComparator(boolean trueFirst)(Code) | | Creates a BooleanComparator that sorts
trueFirst values before
!trueFirst values.
Please use the static factories instead whenever possible.
Parameters: trueFirst - when true , sort true boolean values before false |
compare | public int compare(Object obj1, Object obj2)(Code) | | Compares two arbitrary Objects.
When both arguments are Boolean , this method is equivalent to
BooleanComparator.compare(Boolean,Boolean) compare((Boolean)obj1,(Boolean)obj2) .
When either argument is not a Boolean , this methods throws
a
ClassCastException .
Parameters: obj1 - the first object to compare Parameters: obj2 - the second object to compare negative if obj1 is less, positive if greater, zero if equal throws: ClassCastException - when either argument is not Boolean |
getBooleanComparator | public static BooleanComparator getBooleanComparator(boolean trueFirst)(Code) | | Returns a BooleanComparator instance that sorts
trueFirst values before
!trueFirst values.
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.
Parameters: trueFirst - when true , sort true Boolean s before false a singleton BooleanComparator instance |
getFalseFirstComparator | public static BooleanComparator getFalseFirstComparator()(Code) | | Returns a BooleanComparator instance that sorts
false values before true values.
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.
the false first singleton BooleanComparator |
getTrueFirstComparator | public static BooleanComparator getTrueFirstComparator()(Code) | | Returns a BooleanComparator instance that sorts
true values before false values.
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.
the true first singleton BooleanComparator |
sortsTrueFirst | public boolean sortsTrueFirst()(Code) | | Returns true iff
I sort true values before
false values. In other words,
returns true iff
BooleanComparator.compare(Boolean,Boolean) compare(Boolean.FALSE,Boolean.TRUE) returns a positive value.
the trueFirst flag |
|
|