@ Override public V put ( K key , V value ) { processQueue ( ) ; // throw out garbage collected values first SoftValue < V , K > sv = new SoftValue < V , K > ( value , key , queue ) ; SoftValue < V , K > previous = map . put ( key , sv ) ; addToStrongReferences ( value ) ; return previous != null ? previous . get ( ) : null ; }
Creates a new entry but wraps the value in a SoftValue instance to enable auto garbage collection .