<div dir="ltr">Hi,<div><br></div><div>While working on JDK-8375580, I noticed the following code and comment in URLClassPath:</div><div><br></div><div>        <font face="monospace">// can't use ArrayDeque#addAll or new ArrayDeque(Collection);<br>    // it's too early in the bootstrap to trigger use of lambdas<br>    [..]<br>    for (int i = 0; i < size; i++)<br>        unopenedUrls.add(path.get(i));</font></div><div><br></div><div>This code avoids using bulk add operations on ArrayDeque, presumably to work around problems caused by early initialization of lambda machinery.  </div><div><br></div><div>And indeed, in ArrayDeque::copyElements, we find this:</div><div><br></div><div>         <font face="monospace">c.forEach(this::addLast);</font></div><div><br></div><div>While I don't know if the above code is still a concern, should we consider replacing it with a simple for loop, like this:</div><div><br></div><div>        <font face="monospace">for (E e : c) {<br>        addLast(e);<br>    }</font></div><div><br></div><div>Can this make ArrayDeque somewhat safer to use in early bootstrap code?</div><div><br></div><div>Wdyt?</div><div><br></div><div>Eirik.</div></div>