-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
1.4.1
-
x86
-
windows_xp
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)
======================================================================
- duplicates
-
JDK-4353404 add method Collection.addAll(Iterator i)
- Closed