The type List is not generic; it cannot be parameterized with arguments

In Java, the java.util and java.awt packages both define a type called List.   The util version is the collections interface that is commonly used.  The awt version is a class used for creating a dropdown list GUI element.   

It's easy to import the wrong one in our code: 

package com.example.demo;

import java.util.ArrayList;
import java.awt.List; // wrong import

public class App {
  public static void main(String[] args) {
    List<String> names = new ArrayList<>();
    names.put("Amir");
    names.put("Arnie");
    names.put("Beth");
    names.put("Lucy");
    System.out.println(names);
  }
}

We'll see this compile-time error:

The type List is not generic; it cannot be parameterized with arguments <String>

Changing line 4 to use the correct type fixes the problem:

package com.example.demo;

import java.util.ArrayList;
import java.util.List;

public class App {
  public static void main(String[] args) {
    List<String> names = new ArrayList<>();
    names.put("Amir");
    names.put("Arnie");
    names.put("Beth");
    names.put("Lucy");
    System.out.println(names);
  }
}
[Amir, Arnie, Beth, Lucy]