merge<T> method

Stream<T> merge <T>(Iterable<Stream<T>> streams)

Merges the events from streams into a single (single-subscriber) stream.

This is equivalent to adding streams to a group, closing that group, and returning its stream.

Implementation

static Stream<T> merge<T>(Iterable<Stream<T>> streams) {
  var group = new StreamGroup<T>();
  streams.forEach(group.add);
  group.close();
  return group.stream;
}