Can anything other than null be added to this s1 ? ( and be safely assigned to temp )
Is
<S extends ArrayList<S>>
a useful construct in the language or just a grammar side-effect? Am I correct in interpreting S as an ArrayList that can only hold objects that are ArrayLists of ArrayLists of ArrayLists, etc?
public class Foo{
public static <S extends ArrayList<S>> void f1() {
S s1 = (S) new ArrayList<S>();
// s1.add( ???? ); // can anything be added here other than null?
S temp = s1.get(0);
}
}
>`– Jason Feb 02 '17 at 22:16