I'm a bit confused about the syntax of generic methods. My understanding after reading this post was that generic method should be declared like this:
public static <E> void printArray( E[] inputArray ) with <E> being a placeholder that informs that E is a generic type
So why do I find in the javadoc things like this:
Stream<T> filter(Predicate<? super T> predicate) No placeholder? I would have expect
<T> Stream<T> filter(Predicate<? super T> predicate) And why
<R> Stream<R> map(Function<? super T,? extends R> mapper) This time there is a placeholder, but only for R and not for T. Why?
T, likeinterface Stream<T>. docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html, so the method doesn't accept a new type parameter, you're using one from the outer scope