Reputation: 1377
Suppose I have a function which takes two parameter.
Function2<T1,T2,R> function;
I want to fix the second parameter and makes it a Function1<T1,R>
.
With Function2.apply(T1 t)
, I can only fix the first parameter, is there a way to fix the second parameter?
Upvotes: 3
Views: 128
Reputation: 7108
There's no utility function built into vavr that does a partial application of the second argument. The available utility functions only do partial application for the first argument.
You can easily do the partial application yourself, but you'll need to do that within your own codebase.
static <T1, T2, R> Function1<T1, R> partialApply2(Function2<T1, T2, R> f, T2 p2) {
return p1 -> f.apply(p1, p2);
}
Upvotes: 4
Reputation: 730
In Java, a method signature is part of the method declaration. It's the combination of the method name and the parameter list.
https://www.thoughtco.com/method-signature-2034235
Upvotes: -1