Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Which collections in java can be deleted during traversal, which can't, which can be added during traversal and which can't?
Which collections in java can be deleted during traversal, which can't, which can be added during traversal and which can't?
Either way, the key is to be careful not to cross the line!

Specifically, you should pay attention to whether the traversal method is consistent with the addition and deletion method (that is, the common loop and iterator are mixed).

Or you mean which sets are thread-safe, but two threads can traverse an operation one by one. It's in this api

Anything that is thread-safe in itself will do. If not, you should implement thread safety yourself, but be careful not to cross the line.