public Stream<T> merge(final Iterable<? extends T> with) {
        return new Stream<T>() {
            @Override
            public Iterator<T> iterator() {
                return new ReadOnlyIterator<T>() {

                    Iterator<T> iterator = Stream.this.iterator();
                    Iterator<? extends T> withIterator = with.iterator();

                    @Override
                    public boolean hasNext() {
                        return iterator.hasNext() || withIterator.hasNext();
                    }

                    @Override
                    public T next() {
                        return iterator.hasNext() ? iterator.next() : withIterator.next();
                    }
                };
            }
        };
    }
public Stream < T > merge ( final Iterable < ? extends T > with ) { return new Stream < T > ( ) { @ Override public Iterator < T > iterator ( ) { return new ReadOnlyIterator < T > ( ) { Iterator < T > iterator = Stream . this . iterator ( ) ; Iterator < ? extends T > withIterator = with . iterator ( ) ; @ Override public boolean hasNext ( ) { return iterator . hasNext ( ) || withIterator . hasNext ( ) ; } @ Override public T next ( ) { return iterator . hasNext ( ) ? iterator . next ( ) : withIterator . next ( ) ; } } ; } } ; }
Adds items from another stream to the end of the current stream.

@param with an {@link Iterable} that should be used to emit items after items in the current stream ran out.
@return a new stream that contains items from both streams.