Stream reuse in superclass

Jose jgetino at telefonica.net
Fri Apr 5 09:01:12 PDT 2013


>Are you entirely sure that all the data structures this 
>side-effect touches are thread-safe?  For now and for all times?
 
Of course not, but not just peek(), the base method itself is not
thread-safe, because I didn't delegate on collectors 
and didn't care to use a concurrent structure to store the rows. 
 
I understand your point but I think the moral is applicable to the contents
of forEach() in the same measure it is applicable to the contents of peek().
You can make mistakes in both of them and probably in other places of the
api.
 
Anyway, I'm going to follow the advice and do not pass streams to the parent
class any more, just individual elements.
Conceptually it makes more sense, I think. 
 
 
 
 
 
 
 
 

 



More information about the lambda-dev mailing list