You cannot use primitive types as a generic type-parameter; you need to use the wrapper class for char
, which is Character
:
List<Character> characterList = new ArrayList<>(); //Java 7
or
List<Character> characterList = new ArrayList<Character>(); //Java 5,6
This goes for any class that accepts a generic type-parameter. So for example, if you had tried to use int
, you would get the same error. Instead, you would have had to use Integer
.