RFR 8037106: Optimize Arrays.asList(...).forEach

Alan Bateman Alan.Bateman at oracle.com
Fri Mar 14 14:30:22 UTC 2014


On 14/03/2014 12:04, Paul Sandoz wrote:
> Hi,
>
> This patch overrides some default methods with more optimal ones for the Arrays.asList implementation:
>
>    http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8037106-arrays.asList.forEach/webrev/
>
> It required some surgical work on tests to shove in the Arrays.asList test case, since it is a factory method and does not support structural modification.
>
> There are of course other optimizations that could apply to Arrays.asList, namely that of sub-list, but i have left that as another future possible exercise (plus further work could be done to Abstract/List, including providing a Spliterator for List&  RandomAccess).
>
> Paul.
The override in Arrays look good to me. The refactoring in the tests 
looks good too (and it reduced the line length so should make future 
side-by-side reviews a bit easier).

-Alan.



More information about the core-libs-dev mailing list