1.

How To Make A Collection Thread Safe?

Answer»

USE below methods:

  • Collections.synchronizedList(list);
  • Collections.synchronizedSet(set);
  • Collections.synchronizedMap(MAP);

Above methods take COLLECTION as parameter and RETURN same type of collection which are synchronized and THREAD safe.

Use below methods:

Above methods take collection as parameter and return same type of collection which are synchronized and thread safe.



Discussion

No Comment Found