For JDK 9, annotating terminal operations?
Paul Sandoz
paul.sandoz at oracle.com
Tue Oct 8 08:18:45 PDT 2013
On Oct 8, 2013, at 4:56 PM, Paul Benedict <pbenedict at apache.org> wrote:
> I think some people today are not knowing the difference between the
> terminal and non-terminal operations. Correct me if wrong, but I believe
> the terminal operations are collectively referred to as "reduce".
>
A significant proportion of terminal operations are based off the reduce (or fold) concept, but not all (e.g. forEach).
> In any event, if terminal methods had a @Terminal annotation, then
> developers and source-code analysis tools would know clearly when the true
> work kicks-in.
>
> Any thoughts?
>
I don't think we need it. A terminal operation for Stream<T> is one that returns anything but Stream<T>. That only gets a little more confusing if T is a Stream<U>, which i think will be rare (e.g. concatenation of streams).
Paul.
> --
> Cheers,
> Paul
>
More information about the lambda-dev
mailing list