HashSet<String> set = new HashSet<String>();
 set.add("test1");
 Iterator<String> it = set.iterator();
 while(it.hasNext()){        
    it.next();        
    set.add("sf");    
    it.remove();        
 }
Throws me the exception:
Exception in thread "main" java.util.ConcurrentModificationException
    at java.util.HashMap$HashIterator.remove(Unknown Source)
If I delete the set.add("sf"); it works obviously. 
But why can't I add something to my HashSet while using the iterator?
 
     
    