public final class BooleanPair extends java.lang.Object implements java.io.Serializable, BooleanIndexable
This is similar to Pair, but for raw boolean values.
As these values are defined final, this class is also immutable.
Because there are only 4 possible values of boolean pairs it is strongly recommended to
use the factory method of(boolean, boolean) to create boolean pairs.
This avoids unnecessary object creation.
BooleanIndexable.Base, BooleanIndexable.EntryConsumer| Modifier and Type | Field and Description |
|---|---|
static BooleanPair |
BOTH_FALSE
Pair where both entries are
false. |
static BooleanPair |
BOTH_TRUE
Pair where both entries are
true. |
static BooleanPair |
FALSE_TRUE
Pair where the first entry is
true and the second entry is false. |
boolean |
first
The first value of this pair.
|
boolean |
second
The second value of this pair.
|
static BooleanPair |
TRUE_FALSE
Pair where the first entry is
true and the second entry is false. |
EMPTY, SINGLE_FALSE, SINGLE_TRUEEMPTY_BOOLEAN_ITERATOR| Constructor and Description |
|---|
BooleanPair(boolean first,
boolean second)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
applyAsBooleans(BooleanFunction2<T> function)
Apply a 2-boolean function on this pair.
|
boolean |
equals(java.lang.Object o) |
boolean |
get(int index)
Get the element at the given index.
|
int |
hashCode() |
static BooleanPair |
of(boolean first,
boolean second)
Get one of the 4 predefined possibly values.
|
boolean |
operate(BooleanOperator2 operator)
Call an 2-boolean operator on this pair.
|
int |
size()
Get the size.
|
boolean |
test(BooleanPredicate2 predicate)
Call a 2-boolean predicate on this pair.
|
java.lang.String |
toString() |
Tuple2<java.lang.Boolean,java.lang.Boolean> |
toTuple()
Convert this into a tuple.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAllTo, addToArray, addToArray, asBase, asCollection, asIndexable, asList, booleanIterator, booleanIterator, compare, emptyIndexable, equal, equal, firstMatch, foldLeft, forEachBoolEntry, frozen, getMod, gyt, hash, headSet, indexes, init, initByIndex, intIndexes, isEmpty, iterator, lastMatch, listIterator, nextMatch, previousMatch, reverse, rotated, singleton, subSet, sybSet, tailSet, toArray, toList, toString, view, viewArray, viewArray, viewArray, viewByIndex, viewIndexable, viewIndexable, viewIndexable, viewList, viewList, viewList, withAppendedValue, withCachedHash, withExchangedValueAt, withInsertedValueAt, withRemovedValueAt, withSwappedValuesAtand, containsBool, containsFalse, containsTrue, forEachBool, forEachBooleanFragile, forEachBoolFragile, or, xorpublic static final BooleanPair BOTH_FALSE
false.public static final BooleanPair BOTH_TRUE
true.public static final BooleanPair TRUE_FALSE
true and the second entry is false.public static final BooleanPair FALSE_TRUE
true and the second entry is false.public final boolean first
public final boolean second
public BooleanPair(boolean first,
boolean second)
first - first value of pairsecond - second value of pairpublic int size()
Sizeablepublic boolean get(int index)
BooleanIndexableget in interface BooleanIndexableindex - index between 0 and size() - 1public <T> T applyAsBooleans(@NotNull BooleanFunction2<T> function)
public boolean operate(@NotNull BooleanOperator2 operator)
public boolean test(@NotNull BooleanPredicate2 predicate)
@NotNull public Tuple2<java.lang.Boolean,java.lang.Boolean> toTuple()
@NotNull public static BooleanPair of(boolean first, boolean second)
first - first valuesecond - second valueBOTH_TRUE,
BOTH_FALSE,
TRUE_FALSE,
FALSE_TRUEpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object@NotNull public java.lang.String toString()
toString in class java.lang.Object