A - the argument type.T - the returned value type.public final class ConditionalUnaryFunction<A,T> extends Object implements UnaryFunction<A,T>, Serializable
UnaryFunction
similiar to Java's "ternary"
or "conditional" operator (? :).
Given a predicate
p and functions
f and g, evalautes
to
p.test(x) ? f.evaluate(x) : g.evaluate(x).
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 |
|---|
ConditionalUnaryFunction(UnaryPredicate<? super A> ifPred,
UnaryFunction<? super A,? extends T> thenFunc,
UnaryFunction<? super A,? extends T> elseFunc)
Create a new ConditionalUnaryFunction.
|
public ConditionalUnaryFunction(UnaryPredicate<? super A> ifPred, UnaryFunction<? super A,? extends T> thenFunc, UnaryFunction<? super A,? extends T> elseFunc)
ifPred - ifthenFunc - thenelseFunc - elsepublic T evaluate(A obj)
evaluate in interface UnaryFunction<A,T>obj - the A object to evaluatepublic boolean equals(ConditionalUnaryFunction<?,?> that)
that - ConditionalUnaryFunction to testCopyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.