CopyOnWriteArraySet

  • Thread safe version of Set
  • Internal implementation is CopyOnWriteArrayList
  • If more number of write operation then never suggest to to use CopyOnWriteArraySet
  • Duplicates are not allowed
  • Insertion order is preserved
  • Heterogenious values are allowed
  • Null insertion is allowed
  • While one thread is iterating other threads are allowed to perform write operation and no concurrent modification exception is thrown hence Iterator is FailSafe
  • Iterator cannot perform Remove else with throw UnsupportedOperationException
  • No new method on CopyOnWriteArraySet unlike other ConcurrentClasses

Leave a Comment