Below is my syntax
List synchronizedpubliesdList = Collections.synchronizedList(publiesdList);
I am getting a syntax error of:
List is a raw type. References to generic type List<E> should be parameterized.
Please suggest the solution.
Below is my syntax
List synchronizedpubliesdList = Collections.synchronizedList(publiesdList);
I am getting a syntax error of:
List is a raw type. References to generic type List<E> should be parameterized.
Please suggest the solution.
I've had the same warnings in Eclipse and just click on the warning sign and get the option of adding a type argument to the Hash, List, Array or what have you. Big list of discussion here What is a raw type and why shouldn't we use it?
You may define "publiesdList" this way:
The warning will dissappear.
You need to give it the correct generic type e.g.
I believe that
is not an error, but a warning.
Understanding generics is a cornerstone if you are planning to use Java so I suggest that you should check out Java's tutorial pages about this:
java generics tutorials
So if you know what type of objects are contained in
publiesdList
, than you can do this:If there are multiple types of objects in your list than you can use a wildcard:
Or if you just want to get rid of the warning than you can suppress it like this:
the latter is not recommended however.