Constructor and Description |
---|
FunctionExtensions() |
Modifier and Type | Method and Description |
---|---|
static <V,T,R> Functions.Function1<V,R> |
andThen(Functions.Function1<? super V,? extends T> before,
Functions.Function1<? super T,? extends R> after)
Returns a composed function that first applies the
before
function to its input, and then applies the after function to the result. |
static <V1,V2,T,R> |
andThen(Functions.Function2<? super V1,? super V2,? extends T> before,
Functions.Function1<? super T,? extends R> after)
Returns a composed function that first applies the
before
function to its input, and then applies the after function to the result. |
static Procedures.Procedure0 |
andThen(Procedures.Procedure0 before,
Procedures.Procedure0 after)
Returns a composed
Procedure1 that performs, in sequence, the before
operation followed by the after operation. |
static <T> Procedures.Procedure1<T> |
andThen(Procedures.Procedure1<? super T> before,
Procedures.Procedure1<? super T> after)
Returns a composed
Procedure1 that performs, in sequence, the before
operation followed by the after operation. |
static <V,T,R> Functions.Function1<V,R> |
compose(Functions.Function1<? super T,? extends R> after,
Functions.Function1<? super V,? extends T> before)
Returns a composed function that first applies the
before
function to its input, and then applies the after function to the result. |
static <P1,RESULT> |
curry(Functions.Function1<? super P1,? extends RESULT> function,
P1 argument)
Curries a function that takes one argument.
|
static <P1,P2,RESULT> |
curry(Functions.Function2<? super P1,? super P2,? extends RESULT> function,
P1 argument)
Curries a function that takes two arguments.
|
static <P1,P2,P3,RESULT> |
curry(Functions.Function3<? super P1,? super P2,? super P3,? extends RESULT> function,
P1 argument)
Curries a function that takes three arguments.
|
static <P1,P2,P3,P4,RESULT> |
curry(Functions.Function4<? super P1,? super P2,? super P3,? super P4,? extends RESULT> function,
P1 argument)
Curries a function that takes four arguments.
|
static <P1,P2,P3,P4,P5,RESULT> |
curry(Functions.Function5<? super P1,? super P2,? super P3,? super P4,? super P5,? extends RESULT> function,
P1 argument)
Curries a function that takes five arguments.
|
static <P1,P2,P3,P4,P5,P6,RESULT> |
curry(Functions.Function6<? super P1,? super P2,? super P3,? super P4,? super P5,? super P6,? extends RESULT> function,
P1 argument)
Curries a function that takes six arguments.
|
@Pure public static <P1,RESULT> Functions.Function0<RESULT> curry(Functions.Function1<? super P1,? extends RESULT> function, P1 argument)
function
- the original function. May not be null
.argument
- the fixed argument.null
.@Pure public static <P1,P2,RESULT> Functions.Function1<P2,RESULT> curry(Functions.Function2<? super P1,? super P2,? extends RESULT> function, P1 argument)
function
- the original function. May not be null
.argument
- the fixed first argument of function
.null
.@Pure public static <P1,P2,P3,RESULT> Functions.Function2<P2,P3,RESULT> curry(Functions.Function3<? super P1,? super P2,? super P3,? extends RESULT> function, P1 argument)
function
- the original function. May not be null
.argument
- the fixed first argument of function
.null
.@Pure public static <P1,P2,P3,P4,RESULT> Functions.Function3<P2,P3,P4,RESULT> curry(Functions.Function4<? super P1,? super P2,? super P3,? super P4,? extends RESULT> function, P1 argument)
function
- the original function. May not be null
.argument
- the fixed first argument of function
.null
.@Pure public static <P1,P2,P3,P4,P5,RESULT> Functions.Function4<P2,P3,P4,P5,RESULT> curry(Functions.Function5<? super P1,? super P2,? super P3,? super P4,? super P5,? extends RESULT> function, P1 argument)
function
- the original function. May not be null
.argument
- the fixed first argument of function
.null
.@Pure public static <P1,P2,P3,P4,P5,P6,RESULT> Functions.Function5<P2,P3,P4,P5,P6,RESULT> curry(Functions.Function6<? super P1,? super P2,? super P3,? super P4,? super P5,? super P6,? extends RESULT> function, P1 argument)
function
- the original function. May not be null
.argument
- the fixed first argument of function
.null
.public static <V,T,R> Functions.Function1<V,R> compose(Functions.Function1<? super T,? extends R> after, Functions.Function1<? super V,? extends T> before)
before
function to its input, and then applies the after
function to the result.
If evaluation of either function throws an exception, it is relayed to
the caller of the composed function.V
- the type of input to the before
function, and to the
composed functionT
- the type of output of the before
function, and input to the
after
functionR
- the type of output to the after
function, and to the
composed functionafter
- the function to apply after the before function is appliedbefore
- the function to apply before the after function is appliedbefore
function and then applies the after
functionjava.lang.NullPointerException
- if before
or after
is null
#andThen(Function1, Function1)
public static <V,T,R> Functions.Function1<V,R> andThen(Functions.Function1<? super V,? extends T> before, Functions.Function1<? super T,? extends R> after)
before
function to its input, and then applies the after
function to the result.
If evaluation of either function throws an exception, it is relayed to
the caller of the composed function.V
- the type of input to the before
function, and to the composed functionT
- the type of output of the before
function, and input to the after
functionR
- the type of output to the after
function, and to the composed functionbefore
- the function to apply before the after function is appliedafter
- the function to apply after the before function is appliedbefore
function and then applies the after
functionjava.lang.NullPointerException
- if before
or after
is null
#compose(Function1, Function1)
public static <V1,V2,T,R> Functions.Function2<V1,V2,R> andThen(Functions.Function2<? super V1,? super V2,? extends T> before, Functions.Function1<? super T,? extends R> after)
before
function to its input, and then applies the after
function to the result.
If evaluation of either function throws an exception, it is relayed to
the caller of the composed function.V1
- the type of the first parameter to the before
function, and to the composed functionV2
- the type of the second parameter to the before
function, and to the composed functionT
- the type of output of the before
function, and input to the after
functionR
- the type of output to the after
function, and to the composed functionbefore
- the function to apply before the after
function is appliedafter
- the function to apply after the before
function is appliedbefore
function and then applies the after
functionjava.lang.NullPointerException
- if before
or after
is null#compose(Function1, Function1)
public static <T> Procedures.Procedure1<T> andThen(Procedures.Procedure1<? super T> before, Procedures.Procedure1<? super T> after)
Procedure1
that performs, in sequence, the before
operation followed by the after
operation. If performing either
operation throws an exception, it is relayed to the caller of the
composed operation. If performing the before
operation throws an exception,
the after
operation will not be performed.T
- the type of input for the before
operationbefore
- the operation to perform firstafter
- the operation to perform afterwardsProcedure1
that performs in sequence the before
operation followed by the after
operationjava.lang.NullPointerException
- if before
or after
is nullpublic static Procedures.Procedure0 andThen(Procedures.Procedure0 before, Procedures.Procedure0 after)
Procedure1
that performs, in sequence, the before
operation followed by the after
operation. If performing either
operation throws an exception, it is relayed to the caller of the
composed operation. If performing the before
operation throws an exception,
the after
operation will not be performed.before
- the operation to perform firstafter
- the operation to perform afterwardsProcedure1
that performs in sequence the before
operation followed by the after
operationjava.lang.NullPointerException
- if before
or after
is null