@Override public V put(final K k,final V v){
  try {
    final WeakReference<V> ref=newWeakRef(k,v,referenceQueue);
    final WeakReference<V> oldRef=map.put(k,ref);
    final V oldVal=oldRef == null ? null : oldRef.get();
    if (queue != null) {
synchronized (queue) {
        if (queue.add(v) && DEBUG) {
          log.debug("put: key=" + k + ", val="+ v);
        }
      }
    }
    didUpdate(k,ref,oldRef);
    return oldVal;
  }
  finally {
    removeClearedEntries();
  }
}

@ Override public V put ( final K k , final V v ) { try { final WeakReference < V > ref = newWeakRef ( k , v , referenceQueue ) ; final WeakReference < V > oldRef = map . put ( k , ref ) ; final V oldVal = oldRef == null ? null : oldRef . get ( ) ; if ( queue != null ) { synchronized ( queue ) { if ( queue . add ( v ) && DEBUG ) { log . debug ( "put: key=" + k + ", val=" + v ) ; } } } didUpdate ( k , ref , oldRef ) ; return oldVal ; } finally { removeClearedEntries ( ) ; } }
adds the key - value mapping to the cache .
