public final V putIfAbsent ( K key , LazyFactory < V > factory ) { final int hash = hash ( key ) ; final int slot = indexOf ( hash ) ; // search the chain from the slot for ( Entry < K , V > entry = table [ slot ] ; entry != null ; entry = entry . next ) { if ( entry . hashCode == hash && entry . key . equals ( key ) ) { // found match return entry . value ; } } // no match, insert a new value V value = factory . create ( ) ; insertNewEntry ( hash , key , value , slot ) ; // return the created value return value ; }
Inserts a value for the given key if no value is yet contained for that key . Otherwise returns the value currently contained for the key .