At oldSet.removeAll(deleted); this exception is thrown
ConcurrentModificationException
I add "synchronized" keyword but no change!!
Set<Employees> deleted;
Set<Employees> oldSet = new TreeSet<Employees>(new EmployeeComparator());
oldSet.addAll(employeesListDB);
Set<Employees> newSet = new TreeSet<Employees>(new EmployeeComparator());
newSet.addAll(employeesList);      
 try{      
     deleted = Sets.difference(oldSet, newSet);
    Set<Employees> added = Sets.difference(newSet, oldSet);
    ***oldSet.removeAll(deleted);***
    oldSet.addAll(added);        
}catch(Exception ex){
    System.out.println(ex.getMessage());
}
I also tried the iterator but the same exception appears:
Iterator it = oldSet.iterator();
            Employees e;
            while(it.hasNext())
            {
                e= (Employees)it.next();
                if(oldSet.contains(e))
                    oldSet.iterator().remove();
            }
 
    