Hi Marco,
many thanks for your quick answer. It's true that I'm not so experienced in functional programming in
Java, but I think, I do understand the concept. You are explaining me the general idea of what is going on in the code. I've also understood that. But let's just focus on the Stream.collect method's arguments. for me the average process occurs already in the following fragment code of the Average class:
So why do I still need the following combine method?
Sorry the silly question
but as I said the code is somehow confusing for me. Also if you check the Documentation of the method
Stream.collect(), the method has as we know, 3 arguments: a supplier, an accumulator and a combiner. So they say calling the method is like running the following code:
so again the silly question: where is this combiner coming into play?
Also in the Documentation,a weird explanation of the combiner:
combiner - an associative, non-interfering, stateless function for combining two values, which must be compatible with the accumulator function
In conclusion, since I don't understand the combiner I could not write my own result container from the scratch
Many thanks again for helping