Stream reuse in superclass

Jose jgetino at
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){
		//now the stream is consumed  :-( 

What is the recomended way to handle situations like this?.

Curently I'm collecting the stream into a list and getting two streams from

More information about the lambda-dev mailing list