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

ArrayList.clear does not take constant time

XMLWordPrintable

    • 1.2beta4
    • x86
    • windows_nt
    • Not verified



      Name: rm29839 Date: 05/29/98

      =20
      The documentation of ArrayList says that
      ArrayList.clear runs in *constant time*.

      "The size, isEmpty, get, set, clear, iterator,=20
      and listIterator operations run in constant time."

      But ArrayList.clear resets all the elements in=20
      the array to null to let the garbage collector=20
      work and thus takes *linear time*.
      (Review ID: 30815)
      ======================================================================

            jjb Josh Bloch (Inactive)
            rmandelsunw Ronan Mandel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: