(I know it's not technically correct in Java terminology, but I'm going to say "argument" below where I mean "formal parameter" because mixing "formal parameter" and "type parameter" everywhere is confusing.)
T
is the type parameter for the x
argument.
partial
accepts two arguments:
f
, a function that accepts a T
and a U
and returns an R
:
BiFunction<T, U, R> f
x
, which is of type T
:
T x
partial
returns a new function that only accepts a U
(not a T
and a U
) and returns R
. Instead of expecting a T
argument, the new function uses the x
provided to partial
when calling f
.
In short: It returns a new function in which the first argument (of type T
) has been partially-applied (curried) via partial
's x
argument.
The reason we have <T, U, R>
near the beginning of the declaration is that that's how Java syntax lets us specify that partial
is a generic method, using type parameters T
, U
, and R
(otherwise, they look like type names, not type parameters).