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

Add performance information to ArrayList javadoc

    XMLWordPrintable

Details

    Description

      The JEP for sequenced collection (https://openjdk.org/jeps/431) would add addFirst(), removeFirst() and reversed() methods to lists.

      However, the Javadoc of List mentions:
      > The size, isEmpty, get, set, iterator, and listIterator operations run in constant time. The add operation runs in amortized constant time, that is, adding n elements requires O(n) time. All of the other operations run in linear time (roughly speaking). The constant factor is low compared to that for the LinkedList implementation.

      ...

      ... this should be updated to include that reversed() runs in constant time while addFirst() and removeFirst() run in linear time.

      See: https://mail.openjdk.org/pipermail/core-libs-dev/2023-June/107328.html

      Attachments

        Issue Links

          Activity

            People

              smarks Stuart Marks
              rriggs Roger Riggs
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: