ArrayList.subList

Mike Duigou mike.duigou at oracle.com
Thu Jul 28 22:53:05 UTC 2011


I had a similar issue with Set recently. The problem is that structural changes in sub-sub-lists aren't correctly reflected in the sub-list parents if the sub-sub-lists are disconnected from the parent. The chain back to to the parent through all intermediate sub-lists is used to update list bounds. Seems weird to me but that's nonetheless how the original implementors made it work.

Mike

On Jul 28 2011, at 13:40 , Doug Lea wrote:

> 
> While puzzling over why one of the demo videos on ForkJoin
> out there required surprisingly high sequential thresholds, I
> noticed that ArrayList.subList creates lists with per-access
> overhead proportional to the sublist depth. Which is
> not at all conducive to recursive use. Does anyone
> know any reason why this was done? (No one who I
> thought would know the answer does.) It is easy to keep
> the overhead flat (we do so in CopyOnWriteArrayList and
> the new jsr166e.extra ReadMostlyVector.)
> If no one knows a reason not to, I'll put together a patch.
> (I have a vague deja vu feeling that I might have done this
> once before years ago...)
> 
> -Doug
> 
> 
> 
> 
> 




More information about the core-libs-dev mailing list