I want to make the number of continue in the for statement one in java
I'm analyzing using sonarqube, but I get an error asking to make the number of continue one, but I don't know how to deal with it
I would appreciate it if you could let me know the implementation as follows.
for (line:List) {
if(isAAAA(line)){
Execution statement;
continue;
}
if(isBBB(line)){
Execution statement;
continue;
}
if(isCCC(line)){
Execution statement;
continue;
}
if(isDDD(line)){
Execution statement;
continue;
}
}
Additional
Also, I would like to know about patterns that do not have execution statements.
for (line:List) {
if(isAAAA(line)){
continue;
}
if(isBBB(line)){
continue;
}
if(isCCC(line)){
continue;
}
if(isDDD(line)){
continue;
}
}
Please use if... else if... in this form.Continue is not required.
If the contents of if are only continue, you can combine these conditions with or into one if.
© 2024 OneMinuteCode. All rights reserved.