com.annimon.stream.operator.ObjTakeUntil Maven / Gradle / Ivy
The newest version!
package com.annimon.stream.operator;
import com.annimon.stream.function.Predicate;
import com.annimon.stream.iterator.LsaExtIterator;
import java.util.Iterator;
public class ObjTakeUntil extends LsaExtIterator {
private final Iterator extends T> iterator;
private final Predicate super T> stopPredicate;
public ObjTakeUntil(Iterator extends T> iterator, Predicate super T> predicate) {
this.iterator = iterator;
this.stopPredicate = predicate;
}
@Override
protected void nextIteration() {
hasNext = iterator.hasNext() && !(isInit && stopPredicate.test(next));
if (hasNext) {
next = iterator.next();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy