Return a reference to a new Map that accesses the existing data but with synchronized methods : Collections « Utility Classes « SCJP






import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class MainClass{
    public static void main(String[] argv){
        Map myMap = new HashMap();
        Map safeMap = Collections.synchronizedMap( myMap );
    }
}








8.12.Collections
8.12.1.Java Collections
8.12.2.Make List a Thread-Safe Class
8.12.3.Sorting Collections and Arrays
8.12.4.Return a reference to a new Map that accesses the existing data but with synchronized methods