com.annimon.stream.operator.IntTakeUntil Maven / Gradle / Ivy
The newest version!
package com.annimon.stream.operator;
import com.annimon.stream.function.IntPredicate;
import com.annimon.stream.iterator.PrimitiveExtIterator;
import com.annimon.stream.iterator.PrimitiveIterator;
public class IntTakeUntil extends PrimitiveExtIterator.OfInt {
private final PrimitiveIterator.OfInt iterator;
private final IntPredicate stopPredicate;
public IntTakeUntil(PrimitiveIterator.OfInt iterator, IntPredicate stopPredicate) {
this.iterator = iterator;
this.stopPredicate = stopPredicate;
}
@Override
protected void nextIteration() {
hasNext = iterator.hasNext() && !(isInit && stopPredicate.test(next));
if (hasNext) {
next = iterator.next();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy