java.util.Arrays.asList when used with removeIf throws UnsupportedOperationException
java.util.Arrays.asList() produces a list from which it is impossible to remove elements, so it throws on a removal attempt. You could wrap it with ArrayList: List<Integer> ints = new java.util.ArrayList<>(java.util.Arrays.asList(1,20,20)); Update Arrays.asList() returns return new ArrayList<>(a); where ArrayList is not java.util.ArrayList, but java.util.Arrays.ArrayList (internal class), which does not allow removal.