com.manywho.sdk.utils.StreamUtils Maven / Gradle / Ivy
package com.manywho.sdk.utils;
import java.util.Iterator;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
public class StreamUtils {
public static Stream asStream(Iterable iterable) {
return asStream(iterable.iterator());
}
public static Stream asStream(Iterable iterable, boolean parallel) {
return asStream(iterable.iterator(), true);
}
public static Stream asStream(Iterator iterator) {
return asStream(iterator, false);
}
public static Stream asStream(Iterator iterator, boolean parallel) {
Iterable iterable = () -> iterator;
return StreamSupport.stream(iterable.spliterator(), parallel);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy