Which collection classes are thread-safe?

synchronized is not a class property. It is only applicable to methods and blocks. Following are the few implementations which can be safely used in multi-threaded environment:

  • Vector
  • Hashtable
  • Stack
  • ConcurrentHashMap
  • SynchronizedHashMap
  • CopyOnWriteArrayList
  • CopyOnWriteArraySet

You can get a synchronized version of a Java Collection with

Collections.synchronizedCollection(Collection<T> c)