Just one quick question, say, Car class extends HashMap(String, String).
1.
for (Car car : carList) {
if (car.isEmpty) {
break;
}
doSomething();
}
2.
for (Car car : carList) {
if (!car.isEmpty) {
doSomethingElse();
}
}
Which of the above two is better? Thanks.
---- edited ---- Sorry I did not make my point clear.
The doSomething() method is actually doing different things. I've changed them to doSomething() and doSometingElse().
My question is, will you put all the process in one if()? or first break the loop if the if() condition does not satisfy.
Thanks.