Creates a new Stream over the elements returned by the supplied Sesame Iteration.

@param iteration
the Iteration
@param <T>
the type of elements
@return a Stream over the elements returned by the supplied Iteration
172731
public static <T> Stream<T> create(final Iteration<? extends T, ?> iteration) {
        return new IterationStream<T>(iteration);
    }
229124
private static Stream<Node> streamChildNodes(Node node) {
        int children = node.getChildNodes().getLength();
        Node firstChild = node.getFirstChild();
        if (firstChild == null) return Stream.empty();
        return Stream.iterate(firstChild, prev -> prev != null ? prev.getNextSibling() : null)
            .limit(children)
            .filter(n -> n != null);
    }
503597
public static <T> Stream<T> stream(T root, Function<? super T, ? extends Stream<T>> edges)
    {
        return StreamSupport.stream(spliterator(root, edges), false);
    }
476695
public static <E> void pipe(Iterable<E> iterable, OutputIterator<E> outputIterator) {
        dbc.precondition(iterable != null, "cannot call pipe with a null iterable");
        new ConsumeIntoOutputIterator<>(outputIterator).apply(iterable.iterator());
    }
139420
public static <T> Stream<T> of(Iterable<T> iterable) {
    checkNotNull(iterable);
    return new StreamImpl<T>(iterable);
  }
286561
public static <T> Stream<T> toStream(@javax.annotation.Nonnull final Iterator<T> iterator) {
    return com.simiacryptus.util.Util.toStream(iterator, 0);
  }
14387
@Override
    public StreamT<W,T> peek(final Consumer<? super T> peek) {
        return map(a -> {
            peek.accept(a);
            return a;
        });

    }
1045353
public static Iterator<Byte> iterator(final DataInputStream self) {
        return new Iterator<Byte>() {
            Byte nextVal;
            boolean nextMustRead = true;
            boolean hasNext = true;

            public boolean hasNext() {
                if (nextMustRead && hasNext) {
                    try {
                        nextVal = self.readByte();
                        nextMustRead = false;
                    } catch (IOException e) {
                        hasNext = false;
                    }
                }
                return hasNext;
            }

            public Byte next() {
                Byte retval = null;
                if (nextMustRead) {
                    try {
                        retval = self.readByte();
                    } catch (IOException e) {
                        hasNext = false;
                    }
                } else
                    retval = nextVal;
                nextMustRead = true;
                return retval;
            }

            public void remove() {
                throw new UnsupportedOperationException("Cannot remove() from a DataInputStream Iterator");
            }
        };
    }
1014291
public Iterator<T> iterator() {

        if (input == null)
            return null;

        if (outputIterator == null)
            outputIterator = new SinkIterator<T>(input.iterator());

        return outputIterator;
    }
752731
public static final <K,V> Stream<Entry<K,V>> stream(K key, NavigableMap<K,V> map, boolean parallel)
    {
        return StreamSupport.stream(spliterator(key, map), parallel);
    }
470938
public static <T> Stream<T> parallelConcatt(final Collection<? extends Iterator<? extends T>> c, final int readThreadNum) {
        return parallelConcatt(c, readThreadNum, calculateQueueSize(c.size()));
    }
409881
@javax.annotation.Nonnull
  public PipedInputStream newInputStream() throws IOException {
    @javax.annotation.Nonnull final com.simiacryptus.util.io.TeeOutputStream outTee = this;
    @javax.annotation.Nonnull final AtomicReference<Runnable> onClose = new AtomicReference<>();
    @javax.annotation.Nonnull final PipedOutputStream outPipe = new PipedOutputStream();
    @javax.annotation.Nonnull final PipedInputStream in = new PipedInputStream() {
      @Override
      public void close() throws IOException {
        outPipe.close();
        super.close();
      }
    };
    outPipe.connect(in);
    @javax.annotation.Nonnull final OutputStream outAsync = new AsyncOutputStream(outPipe);
    new Thread(() -> {
      try {
        if (null != heapBuffer) {
          outAsync.write(heapBuffer.toByteArray());
          outAsync.flush();
        }
        outTee.branches.add(outAsync);
      } catch (@javax.annotation.Nonnull final IOException e) {
        e.printStackTrace();
      }
    }).start();
    onClose.set(() -> {
      outTee.branches.remove(outAsync);
      System.err.println("END HTTP Session");
    });
    return in;
  }
256507
public static IterationBuilderOver over(String source)
    {
        Iteration iterationImpl = new Iteration(new NamedFramesSelector(source));
        iterationImpl.setPayloadManager(new NamedIterationPayloadManager(singleVariableIterationName(source)));
        return iterationImpl;
    }
170856
public <T, R> Stream<R> map(Stream<T> stream, Function<? super T, ? extends R> mapper) {
        Callable<Stream<R>> callable = () -> stream.map(mapper);
        return ThreadMethods.forkJoinExecution(callable, concurrencyConfiguration, stream.isParallel());
    }
1183848
public static <R> Stream<R> of(Iterator<R> iterator) {
        return new Stream<R>(iterator);
    }
579903
public static <T> PeekingCloseableIterator<T> peekingIterator(final CloseableIterator<T> iterator) {
        final PeekingIterator<T> peeking = Iterators.peekingIterator(iterator);
        return new PeekingCloseableIterator<T>() {
            @Override
            public void close() {
                iterator.close();
            }

            @Override
            public T peek() {
                return peeking.peek();
            }

            @Override
            public T next() {
                return peeking.next();
            }

            @Override
            public void remove() {
                peeking.remove();
            }

            @Override
            public boolean hasNext() {
                return peeking.hasNext();
            }
        };
    }
367387
@Override
    public java.util.concurrent.Future<CreateStreamResult> createStreamAsync(String streamName, Integer shardCount) {

        return createStreamAsync(new CreateStreamRequest().withStreamName(streamName).withShardCount(shardCount));
    }