### Question:
Functions { public static <T, R> Function<T, Stream<R>> filterMap(final Predicate<? super T> predicate, final Function<? super T, ? extends R> mapper) { return t -> predicate.test(t) ? Stream.of(mapper.apply(t)) : Stream.empty(); } private  Functions(); static Predicate<T> by(final Function<? super T, ? extends U> mapper,
            final Predicate<? super U> predicate); static Function<T, Stream<R>> filterMap(final Predicate<? super T> predicate,
            final Function<? super T, ? extends R> mapper); static Function<U, R> applyPartial(
            final BiFunction<? super T, ? super U, ? extends R> mapper, final T t);  }### Answer:
@Test void test_filterMap() throws Exception { final Object[] os1 = Stream.of("foo", "bar", "baz").filter(s -> s.startsWith("ba")) .map(s -> s + s).toArray(); assertThat(os1).contains("barbar", "bazbaz"); final Object[] os2 = Stream.of("foo", "bar", "baz") .flatMap(filterMap(s -> s.startsWith("ba"), s -> s + s)).toArray(); assertThat(os2).contains("barbar", "bazbaz"); }