My code (cut down to bare essentials is below); it's throwing a ConcurrentModificationException when the hasNext() is called the last time-
PS- I've tried debugging it and I cannot seem to determine how to make it work. If I switch the remove and add methods, it works, but it removes the only value if somethingElse = something which isn't really helpful.
PS- I know of the solution here; but I need it to add AFTER removing the value which is causing the problem
Iterator<String> itr = something.iterator();
while (itr.hasNext()){
    String x = itr.next();
    itr.remove();
    somethingElse.add(x);            
}
Edit- somethingElse can be something or a new object all-together (there's a loop that determines this) This is my first post- if it's too abstract or if the code isn't clear, let me know and I'll post my full code.
Thanks! :)
 
     
     
    