I am wondering is there any other way to make a non-synchronized data structure to be thread safe other than using synchronized data structure like Hashtable and Vector, or using a wrapper like Collections.synchronizedList(List<T> arg) or Collections.synchronizedMap(Map<K,V> arg) ?
I was asked on the interview that how to make a hashmap thread safe, and I told him to use Hashtable or ConcurrentHashMap or use the Collections.synchronizedMap wrapper, however, seems like these answers is not what he is looking for
Yes, you can make it immutable. This is actually an excellent way to make code thread safe in many situations.