I’ve created this nested loop:
for (Type type : types) {
for (Type t : types2) {
if (some condition) {
// Do something and break...
break; // Breaks out of the inner loop
}
}
}
I want to break out of both loops, How can I do that? I've also read the other answers but I can't apply them as most of them used gotos.
I also don't wanna put the inner loop in a different method.
I don't want to rerun the loops. When breaking I'm concluded with the execution of the loop block.