The warning means that List
expects the type of the items but you didn't specify one. Since the compiler can't tell whether you made a mistake or forgot something, it gives the warning.
There are several solutions: If you really don't care what's in the list, use <?>
. It means "can be anything, I don't care."
If you probably care but this is old legacy code and you don't want to fix it, tell Eclipse to ignore it with the @SuppressWarnings("rawtypes")
and/or @SuppressWarnings("unchecked")
if you're casting.
The best solution is to figure out the correct type and use that. This way, the compiler can help you catch more typos at compile time.