Does Java 8 lack a Stream.concat working on a varags of streams?

Just flatMap it:

public static void main(final String[] args) throws Exception {
    final Stream<String> stream1 = /*some stream*/
    final Stream<String> stream2 = /*some stream*/
    final Stream<String> stream3 = /*some stream*/
    final Stream<String> stream4 = /*some stream*/
    final Stream<String> stream5 = /*some stream*/

    final Stream<String> stream = Stream.of(stream1, stream2, stream3, stream4, stream5).flatMap(Function.identity());
}

In your example:

Stream<Integer> resultStream = Stream.of(stream1, stream2, Stream.of(element))
        .flatMap(identity())
        .filter(x -> x != 0)
        .filter(x -> x != 1)
        .filter(x -> x != 2);

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)