package org.algorithm.test;


import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Test {
    
    public static void main(String[] args) {

        List<String> aList = new ArrayList<>();
        aList.add("del");
        aList.add("del");
        aList.add("xx");
        aList.add("yy");

        Iterator<String> it = aList.iterator();
        boolean xx = false;
        while(it.hasNext()){
            String x = it.next();
            if (!xx){

                if (x.equals("xx"))
                    xx = true;
            }
            if(xx){
                it.remove();
            }
        }

        System.out.println(aList);

    }

}
