I’m trying to move a paren balancer I wrote in C++ to Java.
I’m trying to implement the stack with an ArrayDeque class from the Deque interface by declaring an ArrayDeque of characters like so:
Deque<char> parens = new ArrayDeque<char>();
and the compiler chokes on it claiming
expected: reference
found: char
What am I missing?
You can’t use primitive types as generic parameters. You need the corresponding Object wrappers:
See: