RFR: 8143850: Add indexed get() and set() methods to ArrayDeque
Archie Cobbs
acobbs at openjdk.org
Tue May 13 15:22:27 UTC 2025
On Tue, 13 May 2025 08:58:28 GMT, ExE Boss <duke at openjdk.org> wrote:
>> 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)`
>
> src/java.base/share/classes/java/util/ArrayDeque.java line 360:
>
>> 358: *
>> 359: * @param index index of the element to return
>> 360: * @return the element at the specified position in this deque
>
> This can use the inline form of `@return`:
> Suggestion:
>
> * {@return the element at the specified position in this deque}
> *
> * @param index index of the element to return
Indeed - thanks!
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25189#discussion_r2086995656
More information about the core-libs-dev
mailing list