Raw types are unchecked. Use
LinkedList<Integer> li2 = new LinkedList<Integer>(li);
You should never use raw types in new code. It's only provided for backward compatibility reason. See JLS 4.8
To facilitate interfacing with non-generic legacy code, it is also possible to use as a type the erasure (§4.6) of a parameterized type (§4.5). Such a type is called a raw type.
The use of raw types is allowed only as a concession to compatibility of legacy code. The use of raw types in code written after the introduction of genericity into the Java programming language is strongly discouraged. It is possible that future versions of the Java programming language will disallow the use of raw types.
The emphasis was theirs, not mine.
You added a correction to the original question implying that you want to work with raw types specifically. This seems to defeat the purpose of the type safety provided by generics, but you can always use List<Object>
to accomplish this. It's no longer raw, so it's guaranteed to work in the future, although it really doesn't give you any type safety.
Depending on the context, you may also do List<?>
for unbounded wildcards.