java.util.Arrays.asList when used with removeIf throws UnsupportedOperationException : <p>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</p>

<pre><code>public class BiPredicateTest {
    public static void main(String[] args) {
        BiPredicate&lt;List&lt;Integer&gt;, Integer&gt; containsInt = List::contains;
        List&lt;Integer&gt; 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&lt;List&lt;Integer&gt;, Integer&gt; listInt = BiPredicateTest::consumeMe;
        listInt.accept(ints, 15);

    }

    public static void consumeMe(List&lt;Integer&gt; ints, int num) {
        ints.removeIf(i -&gt; i&gt;num);
        ints.forEach(System.out::println);
    }
}
</code></pre>

<p>this clearly is going to compile OK! but when you run it you will see the exception like this</p>

<pre><code>C:\Users\user\Documents&gt;javac BiPredicateTest.java

C:\Users\user\Documents&gt;java BiPredicateTest
true
Exception in thread "main" java.lang.UnsupportedOperationException
        at java.util.AbstractList.remove(AbstractList.java:161)
        at java.util.AbstractList$Itr.remove(AbstractList.java:374)
        at java.util.Collection.removeIf(Collection.java:415)
        at BiPredicateTest.consumeMe(BiPredicateTest.java:22)
        at BiPredicateTest.main(BiPredicateTest.java:17)
</code></pre>

<p>I need some help here to understand why the asList method is not working with removeIf? i assume it will return an instance of ArrayList which implements removeIf method!. </p>

<p>Any answer will be appreciated.</p>

<p>cheers! </p>
