java.util.Arrays.asList when used with removeIf throws UnsupportedOperationException
I am preparing for an OCPJP 8 exam for the next 2 months and currently I this one got my attention as I dont understand why public class BiPredicateTest { public static void main(String[] args) { BiPredicate<List<Integer>, Integer> containsInt = List::contains; List<Integer> ints = java.util.Arrays.asList(1,20,20); ints.add(1); ints.add(20); ints.add(20); System.out.println(containsInt.test(ints, 20)); BiConsumer<List<Integer>, Integer> listInt = BiPredicateTest::consumeMe; listInt.accept(ints, 15); } public static void consumeMe(List<Integer> ints, int num) { ints.removeIf(i -> i>num); ints