Here you can find the source of getMapSafe( ConcurrentHashMap
static ConcurrentHashMap<String, Double> getMapSafe(
ConcurrentHashMap<String, ConcurrentHashMap<String, Double>> map, String key)
//package com.java2s; import java.util.concurrent.ConcurrentHashMap; public class Main { static ConcurrentHashMap<String, Double> getMapSafe( ConcurrentHashMap<String, ConcurrentHashMap<String, Double>> map, String key) { ConcurrentHashMap<String, Double> map2 = map.get(key); if (map2 == null) { map2 = new ConcurrentHashMap<String, Double>(); map.put(key, map2);//from w ww . j a v a2 s . c o m } return map2; } }