// this event is not scheduled to run.
iter.remove();
} else if (nextRunTime == 0 || task.nextRuntime() < nextRunTime) {
// this event occurs before the current nextRuntime,
// so we update nextRuntime.
nextRunTime = task.nextRuntime();
} else if (n > task.nextRuntime()) {
// Since the scheduled events are in the order of soonest to
// latest, we now know that all further events are in the future
// and we can therefore stop iterating.
return;