Skip to content

Instantly share code, notes, and snippets.

import java.util.stream.Stream;
import org.junit.Test;
import static java.util.function.Function.identity;
public class StreamConcat {
@SafeVarargs
public static <T> Stream<T> concatenate(Stream<? extends T>... streams) {
return Stream.of(streams).reduce(Stream.empty(), Stream::concat).map(identity());