Add elements to a List while iterating over it. (Java) [duplicate]
-
29-10-2019 - |
Frage
Possible Duplicate:
Java: adding elements to a collection during iteration
My problem is that I want to expand a list with new elements while iterating over it and I want the iterator to continue with the elements that I just added.
From my understanding the ListIterator.add()
adds an element before the current element in the list, not after it. Is it possible to achieve this in some other way?
Keine korrekte Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow