Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.util.comparator
Class BooleanComparator

    java.lang.Object
      org.springframework.util.comparator.BooleanComparator

All Implemented Interfaces:
  java.io.Serializable, java.util.Comparator<java.lang.Boolean>

    public final class BooleanComparator

extends java.lang.Object
implements java.util.Comparator<java.lang.Boolean>, java.io.Serializable

A Comparator for Boolean objects that can sort either true or false first.

Since:
  1.2.2
Author:
  Keith Donald
See Also:
  Serialized Form

Field Summary
`static BooleanComparator` | `TRUE_HIGH` A shared default instance of this comparator, treating true higher than false.
`static BooleanComparator` | `TRUE_LOW` A shared default instance of this comparator, treating true lower than false.

Constructor Summary
`BooleanComparator(boolean trueLow)` Create a BooleanComparator that sorts boolean values based on the provided flag.

Method Summary
`int` | `compare(java.lang.Boolean v1, java.lang.Boolean v2)`
`boolean` | `equals(java.lang.Object obj)`
`int` | `hashCode()`
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### TRUE_LOW

    public static final BooleanComparator TRUE_LOW

  A shared default instance of this comparator, treating true lower than false.

### TRUE_HIGH

    public static final BooleanComparator TRUE_HIGH

  A shared default instance of this comparator, treating true higher than false.

Constructor Detail

### 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_LOW` and `BooleanComparator.TRUE_HIGH`.

  Parameters:
    `trueLow` - whether to treat true as lower or higher than false
  See Also:
    `TRUE_LOW`, `TRUE_HIGH`

Method Detail

### compare

    public int compare(java.lang.Boolean v1,
                       java.lang.Boolean v2)

  Specified by:
    `compare` in interface `java.util.Comparator<java.lang.Boolean>`

### equals

    public boolean equals(java.lang.Object obj)

  Specified by:
    `equals` in interface `java.util.Comparator<java.lang.Boolean>`
  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD