Variables in pipelines
Jose
jgetino at telefonica.net
Wed Aug 15 12:33:04 PDT 2012
Let suppose I want to do some operations in a stream of rectangles: rotate
them and finding the intersection of the rotateded rectangles with the
original ones:
rects.map(r1->rotate(alpha)).tap(r2)->r2.intersection(r1);
Here "tap" refers to the discusion on forEach
http://mail.openjdk.java.net/pipermail/lambda-dev/2012-August/005463.html
The problem is that being r1 a dummy variable, its reference is lost in the
next link of the chain.
It would be possible and desirable to keep the references of the variables
inside a pipeline?.
Maybe you can use BiMapper to keep trace of another variable, but the code
would be much more cumbersome.
Not to say if you want to reuse two o more variables along the pipeline.
More information about the lambda-dev
mailing list