List of usage examples for java.util Spliterators spliteratorUnknownSize
public static Spliterator.OfDouble spliteratorUnknownSize(PrimitiveIterator.OfDouble iterator, int characteristics)
From source file:Main.java
/** * Creates a parallel {@code Stream} using a given {@code Iterator} * as the source of elements, with no initial size estimate. * * @return a parallel {@code Stream} over the remaining items in the iterator * @see Spliterators#spliteratorUnknownSize(Iterator, int) */// w w w . j a v a 2 s .c o m public static <T> Stream<T> parallelStream(Iterator<T> iterator) { return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, 0), true); }
From source file:Main.java
/** * Creates a sequential {@code Stream} using a given {@code Iterator} * as the source of elements, with no initial size estimate. * * @return a sequential {@code Stream} over the remaining items in the iterator * @see Spliterators#spliteratorUnknownSize(Iterator, int) *//* w w w . j a va 2 s.c o m*/ public static <T> Stream<T> stream(Iterator<T> iterator) { return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, 0), false); }
From source file:org.codice.alliance.libs.mpegts.TSStream.java
/** * Create a stream of PESPackets from a byte source. * * @param byteSource must be non-null// w w w . j a va 2 s .c o m * @return stream of PESPackets * @throws IOException */ public static Stream<PESPacket> from(ByteSource byteSource) throws IOException { notNull(byteSource, "byteSource must be non-null"); return StreamSupport.stream(Spliterators.spliteratorUnknownSize(new PESPacketIterator(byteSource), Spliterator.ORDERED | Spliterator.NONNULL), false); }
From source file:Main.java
/** * Converts an {@link java.util.Iterator} to {@link java.util.stream.Stream}. */// w ww . java 2s. c o m public static <T> Stream<T> iterate(Iterator<? extends T> iterator) { int characteristics = Spliterator.ORDERED | Spliterator.IMMUTABLE; return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, characteristics), false); }
From source file:com.wrmsr.kleist.util.Itertools.java
public static <L, R> Spliterator<Pair<L, R>> zip(Spliterator<L> left, Spliterator<R> right) { return Spliterators.spliteratorUnknownSize(zip(Spliterators.iterator(left), Spliterators.iterator(right)), 0);// w w w . j a va 2 s. com }
From source file:com.simiacryptus.util.test.EnglishWords.java
/** * Load stream.//from w w w . j ava 2 s . c o m * * @return the stream */ public static Stream<EnglishWords> load() { if (thread == null) { synchronized (WikiArticle.class) { if (thread == null) { thread = new Thread(EnglishWords::read); thread.setDaemon(true); thread.start(); } } } Iterator<EnglishWords> iterator = new AsyncListIterator<>(queue, thread); return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, Spliterator.DISTINCT), false) .filter(x -> x != null); }
From source file:com.simiacryptus.util.test.Shakespeare.java
/** * Load stream.// ww w .j av a 2 s . c o m * * @return the stream */ public static Stream<Shakespeare> load() { if (thread == null) { synchronized (WikiArticle.class) { if (thread == null) { thread = new Thread(Shakespeare::read); thread.setDaemon(true); thread.start(); } } } Iterator<Shakespeare> iterator = new AsyncListIterator<>(queue, thread); return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, Spliterator.DISTINCT), false) .filter(x -> x != null); }
From source file:objective.taskboard.utils.ZipUtils.java
public static Stream<ZipStreamEntry> stream(InputStream inputStream) { ZipEntryIterator it = new ZipEntryIterator(new ZipInputStream(inputStream)); return StreamSupport .stream(Spliterators.spliteratorUnknownSize(it, Spliterator.ORDERED | Spliterator.NONNULL), false); }
From source file:de.kaiserpfalzEdv.commons.jee.paging.SortDO.java
@Override public Spliterator<Sort.Order> spliterator() { return Spliterators.spliteratorUnknownSize(iterator(), 0); }
From source file:org.codice.ddf.catalog.ui.metacard.impl.ZipSplitter.java
@Override public Stream<StorableResource> split(StorableResource storableResource, Map<String, ? extends Serializable> arguments) throws IOException { ZipIterator zipIterator = new ZipIterator(storableResource.getInputStream()); return StreamSupport.stream(Spliterators.spliteratorUnknownSize(zipIterator, Spliterator.NONNULL), false) .onClose(zipIterator::close); }