Has anyone ever seen the following in Java?
public void methodName(){
search:
for(Type[] t : Type[] to){
do something...
}
}
Can someone point me to documentation on the use of “search:” in this context? Searching for “search:” has not been productive.
Thanks
It’s a label. From §14.7 of the Java Language specification:
One place you frequently see labels is in nested loops, where you may want to break out of both loops early:
Normally that
breakin the inner loop would break just the inner loop, but not the outer one. But because it’s a directedbreakusing a label, it breaks the outer loop.