[–] 7 points 1 month ago

I like reduce if the reduction function is super simple, but the common cases usually already have their own specialized functions (sum, max, average, etc) so I rarely need reduce itself. The only times I can think of are concatenating a stream of strings in Java, and bitwise-or-ing a bit array into an integer bitset in JS.

Anything more complicated and I reach for a loop. Especially if the aggregated value is itself some kind of collection.

  • source