### Question:
StreamUtils { public static <K, V> List<V> forEach(Collection<K> collection, Function<? super K, ? extends V> applyFunction) { return forEach(collection.stream(), applyFunction); }  static List<V> forEach(Collection<K> collection,
                                         Function<? super K, ? extends V> applyFunction); static List<V> forEach(Stream<K> stream,
                                         Function<? super K, ? extends V> applyFunction); static T forEach(Collection<K> collection,
                                      Function<? super K, ? extends V> applyFunction,
                                      Collector<? super V, ?, T> collector); static List<V> flatMapEach(Collection<K> collection,
                                             Function<? super K, ? extends Collection<? extends V>> function); static List<T> filter(Collection<T> collection,
                                     Predicate<? super T> predicate); static T filter(Collection<K> collection,
                                  Predicate<? super K> predicate,
                                  Collector<? super K, ?, T> collector); static Optional<V> findFirstResult(Collection<K> collection, Function<K, Optional<V>> getter); static Collector<T, ?, Map<K, U>> toLinkedMap(Function<? super T, ? extends K> keyMapper,
                                                                   Function<? super T, ? extends U> valueMapper); static Collector<T, ?, SortedMap<K, U>> toSortedMap(Function<? super T, ? extends K> keyMapper,
                                                                         Function<? super T, ? extends U> valueMapper);  }### Answer:
@Test void testForEach() { List<String> expected = asList("2", "6", "3"); assertEquals(expected, forEach(elements, String::valueOf)); assertEquals(expected, forEach(elements.stream(), String::valueOf)); assertEquals(expected, forEach(elements, String::valueOf, toCollection(ArrayList::new))); }