Why ArrayDeque cannot be created for Sagov?

Suppose I create an ArrayDeque of characters:
ArrayDeque<char> pass_raw = new ArrayDeque<char>();

Or make the function receiving it:
static public void stackUpper(ArrayDeque<char> pass) {
 if (pass.getLast() == 'A') {
pass.addLast('B');
 } else {
pass.addLast('A');
}
 }


But it's not working! IntelliJ does not swear, but the compiler says expected reference (for what?) is Chara:
Main.java:5: error: unexpected type
 public static void stackUpper(ArrayDeque<char> pass) {
^
 required: reference
 found: char

Main.java:39: error: unexpected type
 ArrayDeque<char> pass_raw = new ArrayDeque<char>();
^
 required: reference
 found: char
Main.java:39: error: unexpected type
 ArrayDeque<char> pass_raw = new ArrayDeque<char>();
^
 required: reference
 found: char

What am I doing wrong?
April 19th 20 at 12:29
1 answer
April 19th 20 at 12:31
Solution
In java generics you can't use primitives. For this, there are wrapper classes. For char is Character, int for Integer etc

Find more questions by tags Java