Why many Java Stream interface methods use lower bounded wildcard in parameters instead of generic type?
Many Java Stream interface methods use lower bounded wildcard in parameters for example Stream<T> filter(Predicate<? super T> pred) and void forEach(Consumer<? super T> action) What is the advantage of using Predicate<? super T> over Predicate<T> here? I understand, with Predicate<? super T> as parameter, Predicate object of T and super types can be passed into the method but i can't think of a situation where a Predicate of super type needed over the specific type? For example if i have a Stream<Integer> i can pass Predicate<Integer>, Predicate<Number>, and Predicate<Object> objects as