UnsupportedOperationException - the removeAll method is not supported by this collection (Java Collections)
Arrays.asList
returns a partially unmodifiable implementation (in part of remove*
methods - thanks to @LouisWasserman for the remark) of the List
interface.
EDIT 1: Use an ArrayList
wrapper on it: new ArrayList<Badge>(allBadges);
Your collection might be unmodifiable.
You need to create new List
List<T> list = new ArrayList<>(unmodifiableList);
Now your list is modifiable and you can perform remove and removeAll
operations.