java list的准确remove。避免报java.util.ConcurrentModificationException

java list的正确remove。避免报java.util.ConcurrentModificationExceptionlist的remove首先要从迭代器中re

java list的正确remove。避免报java.util.ConcurrentModificationException
list的remove首先要从迭代器中remove
list的正确的remove的办法:

Iterator<StoreFriendLink >  it=friendlinks.iterator();
                   while(it.hasNext()){
                        StoreFriendLink next=it.next();
                         if(next.getId().equals(id)){
                              it.remove();
                              friendlinks.remove(next);
                        }
                  }