Get Synchronized Map from HashMap in Java
Description
The following code shows how to get Synchronized Map from HashMap.
Example
/* w ww. j a v a 2 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.