code: public V replace(K key, V value) {
          V curValue;
          if (((curValue = get(key)) != null) || containsKey(key)) {
              curValue = put(key, value);
          }
          return curValue;
      }
docs: Replaces the entry for the specified key only if it is
  currently mapped to some value.