Collecion as collector

Jose jgetino at telefonica.net
Thu Apr 18 14:07:50 PDT 2013


I'm wonder why the Collection interface don't extend Collector using default
methods. Al least a collection is the most obvious Collector you can
imagine.

This would allow adding elements to an existing collection using a
straightforward idiom:  

Collection myCollection=..

stram1.collect(myCollection);
stram1.collect(myCollection);

I have done this in custom classes that wrap a Collection and I feel it
makes code more readable. 





More information about the lambda-dev mailing list