Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8143850

(coll) retrofit ArrayDeque to implement List

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • None
    • core-libs

      ArrayDeque stores its elements in an array, but it doesn't implement the List interface. This means that it doesn't allow access to elements by index. It should be only a moderate amount of effort ot allow this, as mapping the list index into the array index is only a bit of arithmetic and logic.

      The new methods that need to be implemented are:

      void add(index, element)
      boolean addAll(index, Collection)
      E get(index)
      int indexOf(Object)
      int lastIndexOf(Object)
      ListIterator listIterator()
      ListIterator listIterator(index)
      E remove(index)
      E set(index, element)
      List<E> subList(from, to)

      Overrides for removeIf(), replaceAll(), and sort() default methods should probably be implemented.

            martin Martin Buchholz
            smarks Stuart Marks
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: