Make ArrayDeque bulk add methods bootstrap-proof

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • None
    • Affects Version/s: None
    • Component/s: core-libs

      ArrayDeque.addElements and ArrayDeque(Collection) uses a lambda method reference in the internal copyElements method:

      private void copyElements(Collection<? extends E> c) {
          c.forEach(this::addLast);
      }

      Since ArrayDeque may be used in early bootstrap code, it would make sense to change this lambda invocation to use a simple loop instead.

      Performance should be neutral, see discussion in https://mail.openjdk.org/pipermail/core-libs-dev/2026-February/159362.html

            Assignee:
            Eirik Bjørsnøs
            Reporter:
            Eirik Bjørsnøs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: