### Question:
StreamUtilities { @SuppressWarnings("unchecked") public static <T> Stream<T> filterDowncast(Stream<?> input, Class<T> type) { return input.filter(obj -> type.isInstance(obj)).map(obj -> (T)obj); } private  StreamUtilities(); static boolean anyMatch(Iterable<? extends T> input, Predicate<? super T> filter); static List<T> filter(Collection<? extends T> input, Predicate<? super T> predicate); @SuppressWarnings("unchecked") static T[] filter(T[] input, Predicate<? super T> predicate); static T filterOne(Collection<? extends T> input, Predicate<? super T> predicate); @SuppressWarnings("unchecked") static Stream<T> filterDowncast(Stream<?> input, Class<T> type); static Collection<R> map(Collection<? extends T> input, Function<? super T, ? extends R> mapper,
            CollectionProvider<R> collectionProvider); @SuppressWarnings("unchecked") static List<R> map(Iterable<? extends T> input, Function<? super T, ? extends R> mapper);  }### Answer:
@Test public void testFilterDowcast() { List<Number> input = Arrays.asList(Integer.valueOf(1), Long.valueOf(2)); Assert.assertEquals(Arrays.asList(Integer.valueOf(1)), StreamUtilities.filterDowncast(input.stream(), Integer.class).collect(Collectors.toList())); }