Is it safe to perform foreach, add, remove, size operations in different threads with the next set?
private final Set<MyObject> myConcurrentHashSet = ConcurrentHashMap.newKeySet();
I.e. I don't need to get maximum accuracy in foreach or size operations but I need to be sure that there will not be any exceptions while I am doing foreach / add / remove / size operations.
I know that ConcurrentHashMap is thread safe, but I am confused about the thread safety of its Set.