Nir
10/06/2020, 3:45 PMinline fun <T, K, R> Grouping<T, K>.aggregate(
operation: (key: K, accumulator: R?, element: T, first: Boolean) -> R
): Map<K, R>
Looking at aggregate, I can understand why, if R
is already a nullable type, you need first
. However, if R is not a nullable type (which is probably the more common case), then it seems like you don't need first
at all; if accumulator is null then you're on the first element, otherwise you're not. Why is there not an overload for aggregate
that takes a 3 parameter lambda?