public < T > T setIfNull ( Class < T > type , T instance ) { Object o = data . putIfAbsent ( type , instance ) ; if ( o != null ) return type . cast ( o ) ; return instance ; }
Overwrites the value only if the current value is null .