Question d’entretien chez IONsoft

Can you remove data on LinkedList directly on looping process?

Réponse à la question d'entretien

Utilisateur anonyme

27 oct. 2017

No, you can't call foo.remove() directly on for each loop, you need to use Iterator. Map your value from foo.next() then remove it. int x = iterator.next(); x.remove();