Package it.unimi.dsi.fastutil.booleans
Interface BooleanPredicate
-
- All Superinterfaces:
java.util.function.Predicate<java.lang.Boolean>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface BooleanPredicate extends java.util.function.Predicate<java.lang.Boolean>
A type-specificPredicate
; provides methods to test a primitive type both as object and as primitive.Except for the boolean case, this interface extends both a parameterized
Predicate
and a type-specific JDK predicate (e.g.,IntPredicate
). For types missing a type-specific JDK predicate (e.g.,short
orfloat
), we extend the predicate associated with the smallest primitive type that can represent the current type (e.g.,int
ordouble
, respectively).- Since:
- 8.5.0
- See Also:
Predicate
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default BooleanPredicate
and(BooleanPredicate other)
Returns a composed type-specific predicate that represents a short-circuiting logical AND of this type-specific predicate and another.default java.util.function.Predicate<java.lang.Boolean>
and(java.util.function.Predicate<? super java.lang.Boolean> other)
Deprecated.Please use the corresponding type-specific method instead.static BooleanPredicate
identity()
Returns aBooleanPredicate
that returns the boolean to be tested unmodified.default BooleanPredicate
negate()
static BooleanPredicate
negation()
Returns aBooleanPredicate
that returns the negation of the boolean to be tested.default BooleanPredicate
or(BooleanPredicate other)
Returns a composed type-specific predicate that represents a short-circuiting logical OR of this type-specific predicate and another.default java.util.function.Predicate<java.lang.Boolean>
or(java.util.function.Predicate<? super java.lang.Boolean> other)
Deprecated.Please use the corresponding type-specific method instead.boolean
test(boolean t)
Evaluates this predicate on the given input.default boolean
test(java.lang.Boolean t)
Deprecated.Please use the corresponding type-specific method instead.
-
-
-
Method Detail
-
test
boolean test(boolean t)
Evaluates this predicate on the given input.- Parameters:
t
- the input.- Returns:
true
if the input matches the predicate, otherwisefalse
-
identity
static BooleanPredicate identity()
Returns aBooleanPredicate
that returns the boolean to be tested unmodified.- See Also:
UnaryOperator.identity()
-
negation
static BooleanPredicate negation()
Returns aBooleanPredicate
that returns the negation of the boolean to be tested.
-
test
@Deprecated default boolean test(java.lang.Boolean t)
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
test
in interfacejava.util.function.Predicate<java.lang.Boolean>
-
and
default BooleanPredicate and(BooleanPredicate other)
Returns a composed type-specific predicate that represents a short-circuiting logical AND of this type-specific predicate and another.- Parameters:
other
- a predicate that will be logically-ANDed with this predicate.- Returns:
- a composed predicate that represents the short-circuiting logical
AND of this predicate and the
other
predicate. - See Also:
Predicate.and(java.util.function.Predicate<? super T>)
- API Notes:
- Implementing classes should generally override this method and keep the default implementation of the other overloads, which will delegate to this method (after proper conversions).
-
and
@Deprecated default java.util.function.Predicate<java.lang.Boolean> and(java.util.function.Predicate<? super java.lang.Boolean> other)
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
and
in interfacejava.util.function.Predicate<java.lang.Boolean>
-
negate
default BooleanPredicate negate()
- Specified by:
negate
in interfacejava.util.function.Predicate<java.lang.Boolean>
-
or
default BooleanPredicate or(BooleanPredicate other)
Returns a composed type-specific predicate that represents a short-circuiting logical OR of this type-specific predicate and another.- Parameters:
other
- a predicate that will be logically-ORed with this predicate.- Returns:
- a composed predicate that represents the short-circuiting logical
OR of this predicate and the
other
predicate. - See Also:
Predicate.or(java.util.function.Predicate<? super T>)
- API Notes:
- Implementing classes should generally override this method and keep the default implementation of the other overloads, which will delegate to this method (after proper conversions).
-
or
@Deprecated default java.util.function.Predicate<java.lang.Boolean> or(java.util.function.Predicate<? super java.lang.Boolean> other)
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
or
in interfacejava.util.function.Predicate<java.lang.Boolean>
-
-