I have below ArrayList
["P", "a", "y", "P", "a", "l", "I", "n", "d", "i", "a"]
Expected result [y, l, I, n, d, i]
I want to remove all duplicates, including original value. For example: 'P' is duplicate. If i use set, it will remove duplicates and one 'P' will display. i want to remove all the 'P'.
I have tried below code. But its validating only if there is even set of chars,
ArrayList<Character> unique = new ArrayList<Character>();
for (Character c : b) {
if (unique.contains(c)) {
unique.remove(c);
} else {
unique.add(c);
}
}
This code validates and removing 'P', but not 'a'. Because 'a' listed 3 t