I was wondering for the n'th time why ArrayDeque does not have get(int) and set(int, E) methods and eventually came across JDK-8143850 <https://bugs.openjdk.org/browse/JDK-8143850> which was created 10 years ago...
This comment exactly describes my own experience: People write code, they need an "addFirst" or "removeLast" type method. > Especially for "removeLast" they find that for List this is the rather > wordy "list.remove(list.size() - 1);" with that ugly -1 constant. So they > try an ArrayDeque, and are happy that these methods exist there and show > the intent clearly... only to find a few minutes later that ArrayDeque > doesn't have a get by index method, even though the structure can support > that trivially in O(1) time -- people really expect it to be there, as an > queue backed by an array almost implies it. I'm pretty sure that it is the > 3rd or 4th time I tried using an ArrayDeque over the past few years only to > realize (again) that this method is missing. I would like to offer to do the following: - Change the title of this bug from "retrofit ArrayDeque to implement List" to "Add indexed get() and set() methods to ArrayDeque" - Propose a corresponding PR and CSR to add get(int) and set(int, E) methods to ArrayDeque But first I want to check with this list first to see if there are any objections? Thanks, -Archie -- Archie L. Cobbs