We would like to know how to convert HashMap to Synchronized Map.
// w w w.j a va2 s . c o m import java.util.Collections; import java.util.HashMap; import java.util.Map; public class Main { public static void main(String[] args) { HashMap hashMap = new HashMap(); Map map = Collections.synchronizedMap(hashMap); } }
The code above generates the following result.