Class BinaryFunctionBinaryProcedure<L,R>
java.lang.Object
org.apache.commons.functor.adapter.BinaryFunctionBinaryProcedure<L,R>
- Type Parameters:
L- the left argument type.R- the right argument type.
- All Implemented Interfaces:
Serializable, BinaryFunctor<L,R>, BinaryProcedure<L, R>, Functor
public final class BinaryFunctionBinaryProcedure<L,R>
extends Object
implements BinaryProcedure<L,R>, Serializable
Adapts a
BinaryFunction
to the BinaryProcedure
interface by ignoring the value returned
by the function.
Note that although this class implements
Serializable, a given instance will
only be truly Serializable if the
underlying function is. Attempts to serialize
an instance whose delegate is not
Serializable will result in an exception.- Version:
- $Revision$ $Date$
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BinaryFunction<? super L, ? super R, ?> TheBinaryFunctionI'm wrapping.private static final longserialVersionUID declaration. -
Constructor Summary
ConstructorsConstructorDescriptionBinaryFunctionBinaryProcedure(BinaryFunction<? super L, ? super R, ?> function) Create anBinaryProcedurewrapping the givenBinaryFunction. -
Method Summary
Modifier and TypeMethodDescriptionstatic <L,R> BinaryFunctionBinaryProcedure <L, R> adapt(BinaryFunction<? super L, ? super R, ?> function) booleanIndicates whether some other object is "equal to" this functor.booleanequals(BinaryFunctionBinaryProcedure<?, ?> that) Learn whether a given BinaryFunctionBinaryPredicate is equal to this.inthashCode()Returns a hash code for this functor adhering to the generalObject.hashCodecontract.voidEvaluatemy function, but ignore its returned value.toString()Returns a human readable description of this functor.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDserialVersionUID declaration.- See Also:
-
function
TheBinaryFunctionI'm wrapping.
-
-
Constructor Details
-
BinaryFunctionBinaryProcedure
Create anBinaryProcedurewrapping the givenBinaryFunction.- Parameters:
function- theBinaryFunctionto wrap
-
-
Method Details
-
run
-
equals
Indicates whether some other object is "equal to" this functor. This method must adhere to generalObject.equalscontract. Additionally, this method can return true only if the specified Object implements the same functor interface and is known to produce the same results and/or side-effects for the same arguments (if any).While implementators are strongly encouraged to override the default Object implementation of this method, note that the default Object implementation does in fact adhere to the functor
equalscontract.- Specified by:
equalsin interfaceFunctor- Overrides:
equalsin classObject- Parameters:
that- the object to compare this functor to- Returns:
trueiff the given object implements this functor interface, and is known to produce the same results and/or side-effects for the same arguments (if any).- See Also:
-
equals
Learn whether a given BinaryFunctionBinaryPredicate is equal to this.- Parameters:
that- BinaryFunctionBinaryPredicate to compare- Returns:
- boolean
-
hashCode
public int hashCode()Returns a hash code for this functor adhering to the generalObject.hashCodecontract. Implementators are strongly encouraged but not strictly required to override the defaultObjectimplementation of this method. -
toString
Returns a human readable description of this functor. Implementators are strongly encouraged but not strictly required to override the defaultObjectimplementation of this method. -
adapt
public static <L,R> BinaryFunctionBinaryProcedure<L,R> adapt(BinaryFunction<? super L, ? super R, ?> function) Adapt the given, possibly-null,BinaryFunctionto theBinaryProcedureinterface. When the givenBinaryFunctionisnull, returnsnull.- Type Parameters:
L- left typeR- right type- Parameters:
function- the possibly-nullBinaryFunctionto adapt- Returns:
- a
BinaryFunctionBinaryProcedurewrapping the givenBinaryFunction, ornullif the givenBinaryFunctionisnull
-