my goal was to remove an item from a list while the code was running.

in the larger scope this is a gateway to morphing running code, maximizing efficacy, evolving code as well as automatic programming and compiling code.

moreover it's about gaining command prompt abilities for running code.

normally removing list items from a loop that is going through that very list is an error raiser, crush event for the program.

see how I went around it:

Code:

        ArrayList<String> tl = new ArrayList<>();
        tl.add("zero");tl.add("one");tl.add("two");tl.add("three");tl.add("four");tl.add("five");
        int c = 0;
        try {
            for (int i = 0; i < tl.size(); i++) {
                if (c == 3){
                    tl.remove(c);
                }
                c++;
                System.out.println(tl.get(i));
            }
        }
        catch(Exception e) {
            for (int i = c; i < tl.size(); i++) {
                System.out.println(tl.get(i));
            }
        }


apart from the removed element, all the list was looped through. king