ArrayList remove method not working?
<p>This may be a duplicate, but I can't see any questions with this error, so Apologies if it is. </p>

<p>I'm trying to use the <code>remove()</code> method to remove an Integer from my <code>ArrayList</code>, however it is giving me <code>java.lang.UnsupportedOperationException</code>. The remove method should take a <code>int</code> or Integer to my understanding, or a value from the <code>ArrayList</code>, however these don't seem to work and give the same error. </p>

<p>I have also tried using "depth" as an <code>index</code>, as that is the <code>index</code> which I want to remove. </p>

<p>Here is my code:</p>

<pre><code>import java.util.*;

public class EP{
public static List&lt;Integer&gt; items = Arrays.asList(12, 13, 48, 42, 38,     2827, 827, 828, 420);
public static void main(String[]args){
System.out.println("Exam List");
for(Integer i: items){
    System.out.println(i);
}
    Scanner scan = new Scanner(System.in);
System.out.println("Enter depth");
int depth = scan.nextInt();
System.out.println("Enter value");
int value = scan.nextInt();
System.out.println(mark(depth, value));
}

public static int  mark(int depth, int value){
int ret = -1; //This ensures -1 is returned if it cannot find it at the specified place
for(Integer i: items){
    if(items.get(depth) == (Integer)value){ //This assummes depth starts at 0
    ret = value;
    items.remove(items.get(depth)); // has UnsupportedOperationException
    }
    }
System.out.println("Updated Exam List");
for(Integer j: items){
    System.out.println(j);
}
return ret;
}
}
</code></pre>