What's the general rule about when a type parameter list is required?
For example, the type parameter list <E>
seen between static
and the return type Set<E>
below: is it required?
public static <E> Set<E> union(Set<E> s1, Set<E> s2) {}
For another example, writing out <E>
is not required in the push()
or pop()
methods below:
public class Stack<E> {
public Stack();
public void push(E e);
public E pop();
}