T
Thomas G. Marshall
The details of generics are currently something I'm not that comfortable
with.
Given the following code which is compiled using eclipse's 1.5 support:
List list = new ArrayList();
list.add("regular");
I get this warning:
Unsafe type operation: Should not invoke the
method add(E) of raw type List. References to
generic type List<E> should be parameterized
But what if I really have no clue about the datatype I'm adding? Does this
mean that I am encouraged by the JLS to use the following formalism:
new ArrayList<? extends Object>()
or similar?
Thanks.
with.
Given the following code which is compiled using eclipse's 1.5 support:
List list = new ArrayList();
list.add("regular");
I get this warning:
Unsafe type operation: Should not invoke the
method add(E) of raw type List. References to
generic type List<E> should be parameterized
But what if I really have no clue about the datatype I'm adding? Does this
mean that I am encouraged by the JLS to use the following formalism:
new ArrayList<? extends Object>()
or similar?
Thanks.