code: public static <T, A, R> Collector<T, ?, R> filter(Predicate<? super T> predicate, Collector<T, A, R> downstream) {
          return Collector.of(
              downstream.supplier(),
              (c, t) -> {
                  if (predicate.test(t))
                      downstream.accumulator().accept(c, t);
              },
              downstream.combiner(),
              downstream.finisher()
          );
      }
docs: Get a {@link Collector} that filters data passed to downstream collector.