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

(coll) Optimize AbstractCollection.toArray()

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 6
    • core-libs

      AbstractCollection.toArray calls hasNext() and next() in a loop,
      but the hasNext() calls are unnecessary since the number of elements is known
      ahead of time, since size() has already been called.

      We should provide the same optimization already used in toArray(T[]).

            martin Martin Buchholz
            martin Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: