Leverages Stream#concat(Stream, Stream) to create a lazily concatenated stream whose elements are all the elements of multiple given streams. The resulting stream is ordered if all input streams are ordered, and parallel if one of the input streams is parallel. @param streams the streams to
(Stream<? extends T>... streams)
| 44 | * @return the concatenated stream |
| 45 | */ |
| 46 | @SafeVarargs |
| 47 | public static <T> Stream<T> concat(Stream<? extends T>... streams) { |
| 48 | Stream<T> result = Stream.of(); |
| 49 | for (int i = streams.length - 1; i >= 0; --i) { |
| 50 | result = Stream.concat(streams[i], result); |
| 51 | } |
| 52 | return result; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Converts a stream to a string. |