T
- Type of item.public final class Ternary<T> extends Object implements Scalar<T>
There is no thread-safety guarantee.
This class implements Scalar
, which throws a checked
Exception
. This may not be convenient in many cases. To make
it more convenient and get rid of the checked exception you can
use the UncheckedScalar
decorator. Or you may use
IoCheckedScalar
to wrap it in an IOException.
new Ternary<>(
5,
input -> input > 3,
input -> input = 8,
input -> input = 2
).value() // will be equal to 8
Constructor and Description |
---|
Ternary(boolean cnd,
T cons,
T alter)
Ctor.
|
Ternary(Scalar<Boolean> cnd,
Scalar<T> cons,
Scalar<T> alter)
Ctor.
|
Ternary(Scalar<Boolean> cnd,
T cons,
T alter)
Ctor.
|
Ternary(X input,
Func<X,Boolean> cnd,
Func<X,T> cons,
Func<X,T> alter)
Ctor.
|
public Ternary(X input, Func<X,Boolean> cnd, Func<X,T> cons, Func<X,T> alter)
X
- Type of inputinput
- The input to pass to all of themcnd
- The conditioncons
- The consequentalter
- The alternativepublic Ternary(boolean cnd, T cons, T alter)
cnd
- The conditioncons
- The consequentalter
- The alternativepublic Ternary(Scalar<Boolean> cnd, T cons, T alter)
cnd
- The conditioncons
- The consequentalter
- The alternativeCopyright © 2017–2019 Cactoos. All rights reserved.