Comment by tantalor
11 hours ago
My favorite gotcha is Java's `Stream.reduce(accumulator)` doesn't call the accumulator if your stream has zero or one elements. This is used for `min(comparator)` and `max(comparator)`. It's very funny when the comparator throws, but only when you have 2 or more elements.
How is that a gotcha? If there aren't two elements how could you possibly expect a function with two arguments to be called? What would you call it with?