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

ArrayList empty constructor documentation is misleading

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 8, 11, 17
    • Fix Version/s: None
    • Component/s: core-libs

      Description

      A DESCRIPTION OF THE PROBLEM :
      Quoting from the ArrayList documentation:

      "Each ArrayList instance has a capacity. The capacity is the size of the array used to store the elements in the list."

      The documentation for the empty constructor goes on to say:

      "Constructs an empty list with an initial capacity of ten"

      This is misleading, as the empty constructor creates an empty list with a capacity (according to the above definition of capacity) of zero.

      I suggest changing the wording to simply state:
      "Constructs an empty list"

      Or alternatively, fully specifying the behaviour of ArrayList with respect to allocating the underlying array, which I think is not the best option.


      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              smarks Stuart Marks
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: