Is it safe to remove and add elements to ConcurrentSkipListSet while iterating over it:
ConcurrentSkipListSet<Element> set = new ConcurrentSkipListSet<Element>(myComparator);
for(Element e : set)
{
if(condition)
{
set.remove(e);
set.add(anotherE);
}
}
where e and anotherE are equal by provided comparator.
Yes it is safe. From java docs: