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

Doug Lea dl at cs.oswego.edu
Fri Mar 29 07:53:44 PDT 2013

On 03/28/13 15:14, Joshua Bloch wrote:

> Sounds like a perfect opportunity to put in immutableEnumSet, which is trivial
> to implement and generally useful. Alternatively, don't share, and see if the
> performance it good enough.  (I suspect it will be.)

Did you think that I of all people would I participate in a
performance-related decision without measuring performance? :-)

Imagine that you had to create a new EnumSet object
every time you invoked arrayList.iterator(). You'd surely
consider alternatives.

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.


More information about the lambda-dev mailing list