The identity must be defined such that for all elements in the stream u, combiner.apply(identity, u) is equal to u.
Paul Anilprem wrote:OP's claim about the code in your book is correct. It will not work for extreme cases.
What are some of the properties of using the singleton pattern? (Choose all that apply.)
F. Requires a public static method to retrieve the instance of the singleton.
Anyway, this is also true for books. In fact, I would argue that it is much more likely for books, as it is designed to teach. And to teach, you have to simplify, and even target simple examples, etc.
Liutauras Vilda wrote:
Alexandru Dragoi wrote:In the exam book we have a bad example of how to write code: