About count()

Jose jgetino at telefonica.net
Thu Aug 30 05:18:17 PDT 2012


Great, good to know I don't need to duplicate the code.

Thanks

-----Mensaje original-----
De: Brian Goetz [mailto:brian.goetz at oracle.com] 
Enviado el: jueves, 30 de agosto de 2012 13:59
Para: Jose
CC: lambda-dev at openjdk.java.net
Asunto: Re: About count()

If test == false, then this degenerates to

   stream.map(...).map(...)

with a few extraneous timer resets.

But the other branch isnt' quite right.  You'd want something like:

Stream stream;

timerReset();
stream=stream.map(lambda1)
If (test){
    stream=stream.into(coll)	
    timerShow();
    stream=coll.stream();
  }
timerReset();
stream=stream.map(lambda2)
If (test){
    coll.clear();
    stream=stream.into(coll);
    timerShow();
    stream=coll.stream();
}


On 8/30/2012 6:13 AM, Jose wrote:
>
> Does this ugly code would work for the regular and test cases?
>
> I mean, if
>
>                                     test=false
>
> I´ll keep on having an interleaved, parallelizable pipleline?
>
> --------------------------------------------
>
> Stream stream;
>
>
> timerReset();
> stream=stream.map(lambda1)
> If (test){
>     stream=stream.into(coll)	
>     timerShow()
>   }
> timerReset();
> stream=stream.map(lambda2)
> If (test){
>     stream=stream.into(coll)	
>     timerShow()
> }
>



More information about the lambda-dev mailing list