code: @SuppressWarnings("unchecked")
      public static <T extends Iterable<E>, R extends Collection<E>, E> Collector<T, ?, R> flat(Supplier<R> supplier) {
          return (Collector<T, ?, R>) Collector.of(supplier, R::addAll, (left, right) -> {
              left.addAll(right);
              return left;
          });
      }
docs: Returns a {@code Collector} that accumulates and flats the input elements into a
  new {@code Collection}, in encounter order. The {@code Collection} is created by
  the provided supplier.
  
  @param <T> the type of the input elements (it must be {@code Iterable})
  @param <R> the type of the resulting {@code Collection}
  @param supplier a {@code Supplier} which returns a new, empty {@code Collection} of
  the appropriate type
  @return a {@code Collector} which collects and flats all the input elements into a
  {@code Collection}, in encounter order