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

ArrayList empty constructor documentation is misleading

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 8, 11, 17
    • core-libs

      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


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

              Created:
              Updated:
              Resolved: