Get Synchronized Map from HashMap - Java Collection Framework

Java examples for Collection Framework:HashMap

Description

Get Synchronized Map from HashMap

Demo Code

 
import java.util.HashMap;
import java.util.Collections;
import java.util.Map;
 
public class Main {
 
  public static void main(String[] args) {
    HashMap hashMap = new HashMap();
   /*from  w  w  w  .ja v  a 2  s.  c o  m*/
    Map map = Collections.synchronizedMap(hashMap);
    
    System.out.println("done");
  }
}

Result


Related Tutorials