To avoid an iteration use CONTINUE key word. Presentation
for (Vehicle printVehicle : getParkedVehicles()) {
if("VAN".equals(printVehicle.getVehicleType().toUpperCase())){
vanCount++;
if(vanCount == 2){
vanCount = 0;
continue;//SKip the iteration related to additional Van record
}
}
}
No comments:
Post a Comment