question: public static < K , V > V atomicGetOrCreate ( ConcurrentMap < K , V > map , K key , Callable < V > ctor ) { V value = map . get ( key ) ; if ( value == null ) { try { value = ctor . call ( ) ; } catch ( Exception e ) { throw new RuntimeException ( "Element constructor should now throw an exception" , e ) ; } V existing = map . putIfAbsent ( key , value ) ; if ( existing != null ) { return existing ; } } return value ; }
target:  Atomically returns a map element for the specifying key. A new instance of value is created if it is missing. This may be efficiently used for creating map of maps/sets. <p/> This method is thread-safe.