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

(coll) retrofit ArrayDeque to implement List

    Details

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

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                martin Martin Buchholz
                Reporter:
                smarks Stuart Marks
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: