What is the result of `Stream.of(1, 2, 3).reduce(1, (a, b) -> a * b)`?

  1. 6
  2. 12
  3. 0
  4. 7
Correct answer 12

Explanation

1 * 1 * 2 * 3 = 6, and since the identity is also 1, it multiplies to 6.

Update: Admin added a tag on this question

Topics

By Admin · · 30 views