Spliterator flags as enum (was Initial java.util.Spliterator putback)

Tim Peierls tim at peierls.net
Fri Mar 29 08:25:54 PDT 2013

On Fri, Mar 29, 2013 at 10:53 AM, Doug Lea <dl at cs.oswego.edu> wrote:

> But really, the painfulness quotient is equally important.
> We'd need to create immutableEnumSet class, and another class
> that can arbitrarily extend the Spliterator's enums with
> other control flags, all for the sake of arriving at an API
> that seems less clear and less easy to use than what we have.

That API doesn't exist, so it's not really fair to say that it seems less
clear and easy to use. As far as I can see in the common discussions, no
one has seriously explored any alternatives.

The presence of such flags in a Java 8 API would (and should) raise a lot
of eyebrows, because it goes against what people have been told for well
over a decade. If it's adopted as is, there had better be a good
explanation for doc readers of why alternatives were rejected. "We were
comfortable with int flags and nothing else significantly better suggested
itself" won't cut it. "We know int flags aren't great for an API, but we
tried very hard to find better alternatives, to no avail" would (if it were


More information about the lambda-dev mailing list