![JAR search and dependency download from the Maven repository](/logo.png)
org.echocat.jsu.SpliteratorUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-stream-utils Show documentation
Show all versions of java-stream-utils Show documentation
Utilities to handle Java Streams.
package org.echocat.jsu;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import java.util.List;
import java.util.Spliterator;
import java.util.function.Predicate;
import java.util.function.Supplier;
public final class SpliteratorUtils {
@Nonnull
public static Spliterator takeWhile(@Nonnull Spliterator extends T> source, @Nonnegative @Nonnull Predicate predicate) {
return new TakeWhile<>(source, predicate);
}
@Nonnull
public static Spliterator> batch(@Nonnull Spliterator extends T> source, @Nonnegative @Nonnull Supplier batchSize) {
return new Batch<>(source, batchSize);
}
@Nonnull
public static Spliterator> batch(@Nonnull Spliterator extends T> source, @Nonnegative int batchSize) {
return batch(source, () -> batchSize);
}
@Nonnull
public static Spliterator generate(@Nonnull Generator extends T> generator) {
return new ContinuingGenerator<>(generator);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy