Miscellany
public java v1 · immutableimport java.util.ArrayList;import java.util.List;public class Test { public static void main(String[] args) { List<Integer> l = new ArrayList<Integer>(); l.add(new Integer(1)); l.add(new Integer(2)); for (Integer i : l) { if (i.equals(2)) { l.remove(i); } } }}