RFR-8148748: ArrayList.subList().spliterator() is not late-binding

Paul Sandoz paul.sandoz at oracle.com
Fri Mar 4 11:45:37 UTC 2016


> On 4 Mar 2016, at 10:26, Tagir F. Valeev <amaembo at gmail.com> wrote:
> 
> Hello!
> 
>>> I'm just worrying a little that my changes might conflict with Ivan
>>> Gerasimov's pending 8079136 issue, so probably it would be better to
>>> wait till it's reviewed and pushed…
> 
> Ivan said that 8079136 is stalled for a while, so I decided to
> continue working on 8148748.

Ok. Hopefully Ivan is unblocked now, but i don’t think it matters much which one gets in first now, given the implementation approach for this patch.


> Here's updated webrev:
> 
> http://cr.openjdk.java.net/~tvaleev/webrev/8148748/r2/
> 

Looks good. I especially like:

 125             addCollection(l.andThen(list -> list.subList(0, list.size())));

Can you also update SpliteratorTraversingAndSplittingTest?

void addList(Function<Collection<T>, ? extends List<T>> l) {
    // @@@ If collection is instance of List then add sub-list tests
    addCollection(l);
}


> PS> Re: maintenance, ordinarily i would agree with you, but ArrayList
> PS> is kind of special being probably the most used collection class.
> PS> Using an anon-impl for SubList.spliterator seem ok in that respect.
> 
> Now it's separate anonymous class as you suggested.
> ArrayListSpliterator is untouched. Note that trySplit() can return
> original ArrayListSpliterator as after the binding their behavior is
> compatible.
> 

Very nice, might be worth an extra comment noting that. Up to you.

Paul.




More information about the core-libs-dev mailing list