About count()

Brian Goetz brian.goetz at oracle.com
Thu Aug 30 04:58:37 PDT 2012


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