L - the left argument type.R - the right argument type.T - the output function returned value type.public final class ConditionalBinaryFunction<L,R,T> extends Object implements BinaryFunction<L,R,T>, Serializable
BinaryFunction
similiar to Java's "ternary"
or "conditional" operator (? :).
Given a predicate
p and functions
f and g, evaluates
to
p.test(x,y) ? f.evaluate(x,y) : g.evaluate(x,y).
Note that although this class implements
Serializable, a given instance will
only be truly Serializable if all the
underlying functors are. Attempts to serialize
an instance whose delegates are not all
Serializable will result in an exception.
| Constructor and Description |
|---|
ConditionalBinaryFunction(BinaryPredicate<? super L,? super R> ifPred,
BinaryFunction<? super L,? super R,? extends T> thenFunc,
BinaryFunction<? super L,? super R,? extends T> elseFunc)
Create a new ConditionalBinaryFunction.
|
public ConditionalBinaryFunction(BinaryPredicate<? super L,? super R> ifPred, BinaryFunction<? super L,? super R,? extends T> thenFunc, BinaryFunction<? super L,? super R,? extends T> elseFunc)
ifPred - ifthenFunc - thenelseFunc - elsepublic T evaluate(L left, R right)
evaluate in interface BinaryFunction<L,R,T>left - the L element of the ordered pair of argumentsright - the R element of the ordered pair of argumentspublic boolean equals(ConditionalBinaryFunction<?,?,?> that)
that - ConditionalBinaryFunction to testCopyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.