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

(coll) Collections should have new method addAll(Iterator)

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.1
    • core-libs



      Name: jl125535 Date: 08/14/2003


      A DESCRIPTION OF THE REQUEST :
      Many times methods return iterators and not collections and it would be nice to be able to add all elements on the iterator to another list. The code is simple enough to write but since the existing API already has addAll(collection) it would be nice to also have addAll(iterator).

      JUSTIFICATION :
      For consistency of API and to be able to use Iterator properly in this case.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      addAll(Iterator iter)
      while (iter.hasNext()) {
          add(iter.next())
      }

      CUSTOMER SUBMITTED WORKAROUND :
      addAll(Iterator iter)
      while (iter.hasNext()) {
          add(iter.next())
      }
      (Incident Review ID: 190785)
      ======================================================================

            Unassigned Unassigned
            jleesunw Jon Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: