Home » JAVA Programming » Data Structures » Question
  1. What happens if two threads simultaneously modify TreeSet?
    1. IteratorModificationException is thrown
    2. FailFastException is thrown
    3. Both threads can perform action successfully
    4. ConcurrentModificationException is thrown
    5. None of these
Correct Option: D

TreeSet provides fail-fast iterator. Hence when concurrently modifying TreeSet it throws ConcurrentModificationException.



Your comments will be displayed only after manual approval.