for (Iterator<Cat> iterator = cats.iterator(); iterator.hasNext();) {
Cat c= iterator.next();<----------------------------
iterator.remove();
}
without this the code is not working if someone can help
what's the need to write this??
Under discussion
Comments (1)
- Popular
- New
- Old
You must be signed in to leave a comment
Guadalupe Gagnon
12 November 2019, 16:47
next calls the next value in the list. Without it you never move the to the next value.
0