Code:
public static void main(String[] arf) {
        List<Integer> l = new ArrayList<>();// Having a list of integers
        l.add(1);
        l.add(2);
        l.add(3);
        for (int i : l) {
            l.remove(i);
        }
        System.out.println(l);
    }
I want to know the reason behind thoring this exception. I know know that internally there is an iterator being used in for each and this can be avoided by using while loop.
 
    