I am trying to use an iterator on an ArrayList ( to get rid of a for loop, don't ask me why... ), however I need to skip the process of one of the arrays upon a boolean condition , should I still use an index and a break ???
// INTERPOLATION
int i = 0;
Iterator<CircularFifoQueue<SensorEvent>> buf = samplingFifoQueues.iterator();
while (buf.hasNext()) {
if ( i == 2 && !mDeviceSensorGyro) { // skip this queue if no gyroscope in device
break;
}
// proceed
buf.next();
i++;
}
thanks for help