If oldValue exists, replaces with newValue

@param oldValue
@param newValue
340137
public void replace(V oldValue, V newValue) {
		if (values.contains(oldValue)) {
			int index = values.indexOf(oldValue);
			values.remove(oldValue);
			values.add(index, newValue);
			
			if (oldValue instanceof JsonEntity) {
				((JsonEntity)oldValue).removePropertyChangeListener(propListener);
			}
			
			if (newValue instanceof JsonEntity) {
				((JsonEntity)newValue).removePropertyChangeListener(propListener);
			}
			
			firePropertyChange("#" + index, oldValue, newValue);
		}
	}
549278
public boolean replace    ( TypeK  key, TypeV  oldValue, TypeV newValue ) {
    return putIfMatch( key, newValue, oldValue ) == oldValue;
  }
1298527
function (property, value) {

    var isString, hasChanged, oldValue, chain;

    // optimal
    if ((isString = (typeof property === "string")) && !~property.indexOf(".")) {
      hasChanged = (oldValue = this[property]) !== value;
      if (hasChanged) this[property] = value;
    } else {

      // avoid split if possible
      chain     = isString ? property.split(".") : property;

      var currentValue  = this,
      previousValue,
      currentProperty,
      newChain;


      for (var i = 0, n = chain.length - 1; i < n; i++) {

        currentProperty = chain[i];
        previousValue   = currentValue;
        currentValue    = currentValue[currentProperty];


        // need to take into account functions - easier not to check
        // if value exists
        if (!currentValue /* || (typeof currentValue !== "object")*/) {
          currentValue = previousValue[currentProperty] = {};
        }

        // is the previous value bindable? pass it on
        if (currentValue.__isBindable) {

          newChain = chain.slice(i + 1);
          // check if the value has changed
          hasChanged = (oldValue = currentValue.get(newChain)) !== value;
          currentValue.set(newChain, value);
          currentValue = oldValue;
          break;
        }
      }


      if (!newChain && (hasChanged = (currentValue !== value))) {
        currentProperty = chain[i];
        oldValue = currentValue[currentProperty];
        currentValue[currentProperty] = value;
      }
    }

    if (!hasChanged) return value;

    var prop = chain ? chain.join(".") : property;

    this.emit("change:" + prop, value, oldValue);
    this.emit("change", prop, value, oldValue);
    return value;
  }
123806
@Override
    public boolean replace(K key, V oldValue, V newValue) {
        int hash = hash(key);
        if (oldValue == null || newValue == null) {
          throw new NullPointerException();
        }
        Segment<K,V> s = segmentForHash(hash);
        return s != null && s.replace(key, hash, oldValue, newValue);
    }
615366
public void setValueOff(String newValue, @Nullable String newName) {
            if (!isChecked()) { // refining on valueOff: facetRefinement needs an update
                searcher.updateFacetRefinement(attribute, valueOff, false)
                        .updateFacetRefinement(newName != null ? newName : attribute, newValue, true)
                        .search();
            }
        this.valueOff = newValue;
        applyEventualNewAttribute(newName);
    }
492390
private static <T> void  setIfNew(Property<T> prop, T newValue)
  {
    if(!Objects.equals(prop.getValue(), newValue))
    {
      prop.setValue(newValue);
    }
  }
668671
function (newValue) {
                var attribute, domElt = this.getDom(), whiteList = ariaTemplatesDomElementWrapper.attributesWhiteList, newAttributeValue;
                var oldValue = this.attributes;

                // remove old members
                for (attribute in oldValue) {
                    if (oldValue.hasOwnProperty(attribute)) {
                        if (attribute == "dataset") {
                            ariaUtilsHtml.removeDataset(domElt, oldValue[attribute]);
                        } else if (!newValue[attribute]) {
                            if (attribute == "classList") {
                                this.getWrapper().classList.setClassName("");
                            } else {
                                domElt.removeAttribute(attribute);
                            }
                        }
                    }
                }

                // add new members
                for (attribute in newValue) {
                    newAttributeValue = newValue[attribute];
                    if (newValue.hasOwnProperty(attribute) && !this.__json.isMetadata(attribute)
                            && newAttributeValue != null) {
                        if (attribute == "classList") {
                            this.getWrapper().classList.setClassName(newAttributeValue.join(" "));
                        } else if (attribute == "dataset") {
                            ariaUtilsHtml.setDataset(domElt, newAttributeValue);
                        } else if (whiteList.test(attribute) && newAttributeValue !== oldValue[attribute]) {
                            domElt.setAttribute(attribute, newAttributeValue);
                        }
                    }
                }

                this.attributes = this.__json.copy(newValue);
            }
969139
private void updateScalarReplaceValue(String currentValue, String newValue) {
        m_dbTran.addScalarValueColumn(m_tableDef, m_dbObj.getObjectID(), m_fieldName, newValue);
        Set<String> currTermSet = tokenize(Utils.isEmpty(currentValue) ? "" : currentValue);
        Set<String> newTermSet = tokenize(newValue);
        for (String term : currTermSet) {
            if (!newTermSet.remove(term)) {
                unindexTerm(term);
            }
        }
        indexTerms(newTermSet);
        addFieldTermReferences(newTermSet);
        if (Utils.isEmpty(currentValue)) {
            addFieldReference();
        }
    }
435719
public boolean replace(String key, CacheEntry oldValue, CacheEntry newValue) {
		final String sourceMethod = "replace"; //$NON-NLS-1$
		boolean replaced = false;
		SignalUtil.lock(cloneLock.readLock(), sourceClass, sourceMethod);
		try {
			replaced = map.replace(keyPrefix + key, oldValue, newValue);
			if (replaced && oldValue != newValue) {
				oldValue.delete(cacheMgr);
			}
		} finally {
			cloneLock.readLock().unlock();
		}
		return replaced;
	}
734760
public static void putValue(String key, Object newValue) {
        Object oldValue = CFG.get(key);
        if (changed(oldValue, newValue)) {
            CFG.put(key, newValue);
            List<RpcConfigListener> rpcConfigListeners = CFG_LISTENER.get(key);
            if (CommonUtils.isNotEmpty(rpcConfigListeners)) {
                for (RpcConfigListener rpcConfigListener : rpcConfigListeners) {
                    rpcConfigListener.onChange(oldValue, newValue);
                }
            }
        }
    }
53134
public void replace(XElement oldChild, XElement newChild) {
        int idx = children.indexOf(oldChild);
        if (idx >= 0) {
            children.get(idx).parent = null;
            children.set(idx, newChild);
            newChild.parent = this;
        }
    }
747827
protected void requestElementUpdate (String name, int index, Object value, Object oldValue)
    {
        requestElementUpdate(name, index, value, oldValue, Transport.DEFAULT);
    }
6497
function resolveBindingValue(oldValue, value) {
    if (value === undefined && oldValue === null) {
      return value;
    }
    return (value === null || value === undefined) ? oldValue : value;
  }
600094
protected void doNotifyListenersOfChangedValues(Map<K, R> oldValues, Map<K, R> newValues) {
        List<MapValueChangeListener<K, R>> listenersCopy = new ArrayList<MapValueChangeListener<K, R>>(listeners);
        Map<K, R> oldUnmodifiable = Collections.unmodifiableMap(oldValues);
        Map<K, R> newUnmodifiable = Collections.unmodifiableMap(newValues);
        for (MapValueChangeListener<K, R> listener : listenersCopy) {
            listener.valuesChanged(this, oldUnmodifiable, newUnmodifiable);
        }
    }
1135402
public void setValue(byte[] newValue) throws Exception
    {
        Preconditions.checkState(state.get() == State.STARTED, "not started");

        Stat result = client.setData().forPath(path, newValue);
        updateValue(result.getVersion(), Arrays.copyOf(newValue, newValue.length));
    }
629273
private Map<String, String> replaceInMapValues(Map<String, String> map,
                                                   String oldVal,
                                                   String newVal) {
        for (String key : map.keySet()) {
            String value = map.get(key);
            if (value.contains(oldVal)) {
                value = StringUtils.replace(value, oldVal, newVal);
                map.put(key, value);
            }
        }
        return map;
    }
800874
function(fields, oldValue) {
            fields = this.__resolveFields(fields);

            var prop, key;

            this.__checkEmitEvent(true);

            if (fields.length) {
                prop = fields.slice(0, -1).join('.');
                key  = _.last(fields);

                this.__emitEvent('property.' + prop + '.item_removed', key, oldValue);
                this.__emitEvent('property.item_removed', prop, key, oldValue);
            }

            prop = fields.join('.');

            this.__emitEvent('property.' + prop + '.remove',  oldValue);
            this.__emitEvent('property.remove', prop, oldValue);

            return this;
        }