code: @Override
      public final boolean replace(K key, V oldValue, V newValue) {
          long hash, allocIndex;
          Segment<K, V> segment;
          V v;
          if ((allocIndex = (segment = segment(segmentIndex(hash = keyHashCode(key))))
                  .find(this, hash, key)) > 0 &&
                  ((v = segment.readValue(allocIndex)) == oldValue ||
                          (oldValue != null && valuesEqual(oldValue, v)))) {
              segment.writeValue(allocIndex, newValue);
              return true;
          }
          return false;
      }
docs: Replaces the entry for the specified key only if currently mapped to the specified value.
  Values are compared using {@link #valuesEqual(Object, Object)} method.
  
  @param key key with which the specified value is associated
  @param oldValue value expected to be associated with the specified key
  @param newValue value to be associated with the specified key
  @return {@code true} if the value was replaced