error: type List does not take parameters

user3292534 picture user3292534 · Apr 9, 2014 · Viewed 50.4k times · Source

I get the following error despite it's exactly one used in examples:

error: type List does not take parameters

List<String> strings_wat = new ArrayList<String>();

Java is version 1.7 and the class is NOT named ArrayList.

Answer

BackSlash picture BackSlash · Apr 9, 2014

You are likely importing java.awt.List.

You should instead import java.util.List, which is a parameterized type.