RFR: 8143850: Add indexed get() and set() methods to ArrayDeque

Archie Cobbs acobbs at openjdk.org
Tue May 13 15:22:27 UTC 2025


Because it is backed by an array, the `ArrayDeque` class has the ability to get and replace any element in the list (accessed by index) in constant time. However, this capability is not exposed in the API.

Please review this PR which adds the following two new methods to `ArrayDeque`:
* `public E get(int index)`
* `public E set(int index, E element)`

-------------

Commit messages:
 - Add placeholder @since Javadoc tags.
 - Use inline @return Javadoc tag per review suggestion.
 - Add indexed get() and set() methods to ArrayDeque.

Changes: https://git.openjdk.org/jdk/pull/25189/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25189&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8143850
  Stats: 146 lines in 2 files changed: 146 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/25189.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25189/head:pull/25189

PR: https://git.openjdk.org/jdk/pull/25189


More information about the core-libs-dev mailing list