I have multiple sets of objects. I want to add the id (stored in array lists of the objects) to previously existing objects if names(strings) of two objects are the same.
for (OperatorClass s1: set_2)
{
for (OperatorClass s2: set_4)
{
if (s2.get_Name().equals(s1.get_Name()))
{
set_4.remove(s2);
s2.add_id(s1.get_Id().get(0));
set_4.add(s2);
}
}
}
I know this will give a concurrency exception at run time. Can someone guide me on how to deal with this issue?