I am trying to remove objects from a list and I get the following exception :
failure:java.util.ConcurrentModificationException null
And this is how I try to remove the objects from the list:
private List<testVO> removeDuplicateEntries(List<testVO> sessionList,List<testVO> dbList){
        for (Iterator<testVO> dbIterator = dbList.listIterator(); dbIterator.hasNext(); ) {
            testVO voDB = dbIterator.next();
            for (Iterator<testVO> sessionIterator = sessionList.iterator(); sessionIterator.hasNext();) {
                testVO voSession = (testVO) sessionIterator.next();
                if(voDB.getQuestionID().intValue() == voSession.getQuestionID().intValue()){
                    //remove the object from sesion list
                    sessionIterator.remove();
                    //Add the object from DB to session list
                    sessionList.add(voDB);
                }
            }
        }
        return sessionList;
    }
I would like to remove the duplicates which are currently in sessionList and add the ones from dbList.
 
     
     
    