/** * Returns a new {@code StreamEx} which is a concatenation of this stream * and the supplied value. * * <p> * This is a <a href="package-summary.html#StreamOps">quasi-intermediate * operation</a> with <a href="package-summary.html#TSO">tail-stream * optimization</a>. * * @param value the value to append to the stream * @return the new stream * @since 0.5.4 */ public StreamEx<T> append(T value) { return appendSpliterator(null, new ConstSpliterator.OfRef<>(value, 1, true)); }
/** * Returns a new {@code StreamEx} which is a concatenation of this stream * and the stream created from supplied collection. * * <p> * This is a <a href="package-summary.html#StreamOps">quasi-intermediate * operation</a>. * * <p> * May return this if the supplied collection is empty and non-concurrent. * * @param collection the collection to append to the stream * @return the new stream * @since 0.2.1 */ public StreamEx<T> append(Collection<? extends T> collection) { return appendSpliterator(null, collection.spliterator()); }
/** * Returns a new {@code StreamEx} which is a concatenation of this stream * and the supplied values. * * <p> * This is a <a href="package-summary.html#StreamOps">quasi-intermediate * operation</a>. * * <p> * May return this if no values are supplied. * * @param values the values to append to the stream * @return the new stream */ @SafeVarargs public final StreamEx<T> append(T... values) { return appendSpliterator(null, Spliterators.spliterator(values, Spliterator.ORDERED)); }