My question is related to: What does idempotent method mean and what are the side effects in case of calling close method of java.lang.AutoCloseable?
As to the method in java.util.stream.Stream.peek(), in the book Oracle Certified Professional Java SE 8 Study Guide > chapter 4 Functional programming > Using Streams > Using Common Intermediate Operations, it was stated that peek() is intended to perform an operation without changing the result
My question is: can I say in practice, the action in peek(Consumer action) should be idempotent even though the stateful code in peek() can compile?