I just wanted to know, what the real benefits of Internal vs External Iterations are and why it is better to use internal operations (that's what I heard at least). Is it also possible to delete elements of a collection while internally iterating over the collection? Like in the code example:
I know that the code readability of internal iterations is better, but are there some other benefits like performance improvements?
//List with Strings of Fruit-Names
Iterator i = aList.iterator();
String str = "";
while (i.hasNext()) {
str = (String) i.next();
if (str.equals("Orange")) {
i.remove();
System.out.println("\nThe element Orange is removed");
break;
}
}