Search code examples
javalistcompiler-errorsgeneric-type-argument

error: type List does not take parameters


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.


Solution

  • You are likely importing java.awt.List.

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