Package org.cactoos.scalar
Class And
- java.lang.Object
-
- org.cactoos.scalar.And
-
public final class And extends Object implements Scalar<Boolean>
Logical conjunction. This class performs short-circuit evaluation in which arguments are executed only if the preceding argument does not suffice to determine the value of the expression.This class could be also used for matching multiple boolean expressions:
new And( new True(), new True(), new True() ).value(); // the result is true new And( new True(), new False(), new True() ).value(); // the result is false
This class implements
Scalar
, which throws a checkedException
. This may not be convenient in many cases. To make it more convenient and get rid of the checked exception you can use theUnchecked
decorator. Or you may useIoChecked
to wrap it in an IOException.There is no thread-safety guarantee.
-
-
Constructor Summary
Constructors Constructor Description And(Iterable<? extends Scalar<Boolean>> iterable)
Ctor.And(Func<? super X,Boolean> func, Iterable<? extends X> src)
Ctor.And(Func<? super X,Boolean> func, X... src)
Ctor.And(Scalar<Boolean>... scalar)
Ctor.And(X subject, Iterable<? extends Func<? super X,Boolean>> conditions)
Ctor.And(X subject, Func<? super X,Boolean>... conditions)
Ctor.
-
-
-
Constructor Detail
-
And
@SafeVarargs public And(Func<? super X,Boolean> func, X... src)
Ctor.- Type Parameters:
X
- Type of items in the iterable- Parameters:
func
- Func to mapsrc
- The iterable
-
And
public And(Func<? super X,Boolean> func, Iterable<? extends X> src)
Ctor.- Type Parameters:
X
- Type of items in the iterable- Parameters:
func
- Func to mapsrc
- The iterable- Since:
- 0.24
-
And
@SafeVarargs public And(X subject, Func<? super X,Boolean>... conditions)
Ctor.- Type Parameters:
X
- Type of items in the iterable- Parameters:
subject
- The subjectconditions
- Funcs to map- Since:
- 0.34
-
And
public And(X subject, Iterable<? extends Func<? super X,Boolean>> conditions)
Ctor.- Type Parameters:
X
- Type of items in the iterable- Parameters:
subject
- The subjectconditions
- Funcs to map- Since:
- 0.49
-
And
@SafeVarargs public And(Scalar<Boolean>... scalar)
Ctor.- Parameters:
scalar
- The Scalar.
-
-