3 ms·
That's my point, we don't have much more than that. Even a 2-arg function is missing. You can supplement with something like Vavr or just write your own, but ev
by debug-desperado 4y ago
That's my point, we don't have much more than that. Even a 2-arg function is missing. You can supplement with something like Vavr or just write your own, but even then it's not pleasant to read "Function3<A, B, C, D>".
Typescript, Kotlin, and Scala all do this way better. Here's an example from Kotlin (it's an extension function, but focus on the combiner lambda):
fun <T, R> Collection<T>.fold(
initial: R,
combine: (acc: R, nextElement: T) -> R
): R {
....
}
- kaba0 4y agoJust nitpicking, but there is a BiFunction generic class in Java, but I understand your point. Yeah, some syntactic sugar could come in handy, though I don’t think that it would be a real productivity boost, more just an annoyance.