Class BooleanComparator
java.lang.Object
org.springframework.util.comparator.BooleanComparator
- All Implemented Interfaces:
Serializable, Comparator<Boolean>
- Since:
- 1.2.2
- Author:
- Keith Donald, Eugene Rabii
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BooleanComparatorA shared default instance of this comparator, treatingtruehigher thanfalse.static final BooleanComparatorA shared default instance of this comparator, treatingtruelower thanfalse. -
Constructor Summary
ConstructorsConstructorDescriptionBooleanComparator(boolean trueLow) Create a BooleanComparator that sorts boolean values based on the provided flag. -
Method Summary
Methods inherited from interface Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
TRUE_LOW
A shared default instance of this comparator, treatingtruelower thanfalse. -
TRUE_HIGH
A shared default instance of this comparator, treatingtruehigher thanfalse.
-
-
Constructor Details
-
BooleanComparator
public BooleanComparator(boolean trueLow) Create a BooleanComparator that sorts boolean values based on the provided flag.Alternatively, you can use the default shared instances:
BooleanComparator.TRUE_LOWandBooleanComparator.TRUE_HIGH.- Parameters:
trueLow- whether to treat true as lower or higher than false- See Also:
-
-
Method Details
-
compare
- Specified by:
comparein interfaceComparator<Boolean>
-
equals
-
hashCode
-
toString
-