Stream reuse in superclass
Jose
jgetino at telefonica.net
Thu Apr 4 13:59:05 PDT 2013
I have a class that contains a method that consumes a Stream (previously was
a Collection)
Class Foo<T>{
bar(Stream<T> s){
.........
}
}
This method is overriden in a subclass, that first consumes the stream and
then calls super
Class PowerFoo<T> extends Foo<T>{
bar(Stream<T> s){
doImportantThingsWidth(s);
//now the stream is consumed :-(
super.bar(s)
}
}
What is the recomended way to handle situations like this?.
Curently I'm collecting the stream into a list and getting two streams from
it.
More information about the lambda-dev
mailing list