void () { Map<String, Boolean> map = null; final Set<Map.Entry<String, Boolean>> entries = map.entrySet(); for(Iterator<Map.Entry<String, Boolean>> it = entries.iterator(); it.hasNext();){ boolean wouldFit = it.next().getValue(); if(wouldFit){ // if it would fit before, it might not now it.remove(); // can't be foreach } } }