aQute.bnd.stream.AbstractWhile Maven / Gradle / Ivy
The newest version!
package aQute.bnd.stream;
import static java.util.Objects.requireNonNull;
import java.util.Comparator;
import java.util.Spliterator;
import java.util.function.Consumer;
import java.util.function.Predicate;
abstract class AbstractWhile implements Spliterator, Consumer {
final Spliterator spliterator;
final Predicate super T> predicate;
T item;
AbstractWhile(Spliterator spliterator, Predicate super T> predicate) {
this.spliterator = requireNonNull(spliterator);
this.predicate = requireNonNull(predicate);
}
@Override
public Spliterator trySplit() {
return null;
}
@Override
public long estimateSize() {
return spliterator.estimateSize();
}
@Override
public long getExactSizeIfKnown() {
return -1L;
}
@Override
public int characteristics() {
return spliterator.characteristics() & ~(Spliterator.SIZED | Spliterator.SUBSIZED);
}
@Override
public Comparator super T> getComparator() {
return spliterator.getComparator();
}
@Override
public void accept(T item) {
this.item = item;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy