I am facing with this unwanted char
to int
conversion in a loop. Say I have this List of Characters and I want to remove one of those:
List<Character> chars = new ArrayList<>();
chars.add('a');
chars.add('b');
chars.add('c');
chars.remove('a'); // or chars.remove('a'-'0');
so 'a'
is interpreted as its int
value and I'm getting an IndexOutOfBoundsException
exception. Is there any easy workaround for this?