List of utility methods to do Stream Operation
boolean | isEmpty(final Stream Checks whether the given stream is empty. return stream.count() <= 0;
|
boolean | isFinite(Stream is Finite throw new UnsupportedOperationException("Cannot be implemented"); |
Iterable | iterableOf(Stream convert stream to iterable return stream::iterator;
|
Stream | iteratorToFiniteStream(Iterator iterator To Finite Stream final Iterable<T> iterable = () -> iterator; return StreamSupport.stream(iterable.spliterator(), parallel); |
Stream | iteratorToStream(final Iterator Convert an Iterator to a Stream return iteratorToStream(iterator, false);
|
Stream | lazyPartition(final Stream lazy Partition final Iterator<T> iterator = stream.iterator(); final Iterable<Stream<T>> partitionedIterable = () -> new Iterator<Stream<T>>() { public boolean hasNext() { return iterator.hasNext(); public Stream<T> next() { List<T> partition = new ArrayList<>(); while (partition.size() < maxPartitionSize && iterator.hasNext()) { ... |
LongStream | lazyStream(PrimitiveIterator.OfLong iterator) Utility Method to create a stream from an iterator. return longStream(spliteratorUnknownSize(iterator, IMMUTABLE | NONNULL), false);
|
long[] | longArray(Stream Returns an array view of a Stream of Long return stream.mapToLong(Long::valueOf).toArray();
|
List | longList(LongStream stream) Returns a List view of a LongStream return stream.mapToObj(Long::valueOf).collect(toList());
|
Stream | makeStream(final Object[] array) make Stream return Arrays.stream(array).map(Object::toString);
|