what is the difference between forEach and iterators
Can anyone explai
⌛ This post has been reserved for your question.Hey @lip! Please useor the/closebutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.Close Post
for(String sl: StringList){
}Iterator allows removing the current elementfor(String s: StringList{
StringList.remove(s);
} Is this valid?remove methodListsIterator can be used for avoiding that exception in scenarios like that💤 Post marked as dormantThis post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use./help ping
Warning: abusing this will result in moderative actions taken against you.
💤 Post marked as dormantThis post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use./help ping
Warning: abusing this will result in moderative actions taken against you.
for(String sl: StringList){
}IteratorIteratorfor(String s: StringList{
StringList.remove(s);
}removeListfor(Iterator<String> it = yourCollection.iterator(); it.hasNext();){
String next = it.next();
if(next.isBlank()){
it.remove();
}
}