Optimized implementation to perform both a remove and an add
@param toRemove
@param toAdd
518011
public void removeAndAdd(final String toRemove, final String toAdd) {
      writeLock.lock();
      try {
         FileListCacheValue fileList = getFileList();
         boolean done = fileList.addAndRemove(toAdd, toRemove);
         if (done) {
            updateFileList(fileList);
            if (trace) {
               log.trace("Updated file listing: added " + toAdd + " and removed " + toRemove);
            }
         }
      } finally {
         writeLock.unlock();
      }
   }
1215775
public function removeEntry(MenuEntry $toRemove) {

		foreach($this->entries as $k => $e) {

			if($e === $toRemove) {

				array_splice($this->entries, $k, 1);

				if($toRemove instanceof DynamicMenuEntry) {

					$ndx = array_search($toRemove, $this->dynamicEntries, TRUE);

					if($ndx !== FALSE) {
						array_splice($this->dynamicEntries, $ndx, 1);
					}

				}

				$toRemove = NULL;
				break;
			}
		}
		
		return $this;

	}
1038719
synchronized void removeLease(String holder, String src) {
    Lease lease = getLease(holder);
    if (lease != null) {
      removeLease(lease, src);
    }
  }
267106
function (toRemove, options) {
        toRemove = _.isString(toRemove) ? toRemove : toRemove.key;

        options = options || {};

        if (!toRemove) { // Nothing to remove :(
            return;
        }

        options.ignoreCase && (toRemove = toRemove.toLowerCase());

        this.headers.remove(function (header) {
            var key = options.ignoreCase ? header.key.toLowerCase() : header.key;
            return key === toRemove;
        });
    }
774749
<S extends Storable> void inserted(final MapStorage<S> storage, final S key) {
        addToUndoLog(new Undoable() {
            public void undo() {
                storage.mapRemove(key);
            }

            @Override
            public String toString() {
                return "undo insert by remove: " + key;
            }
        });
    }
572458
private void cleanup(JobID jobId) {
		if (!lru.contains(jobId)) {
			lru.addFirst(jobId);
		}
		if (lru.size() > this.maxEntries) {
			JobID toRemove = lru.removeLast();
			this.jobAccumulators.remove(toRemove);
		}
	}
1214075
protected void entryRemoved (V entry)
    {
        if (entry != null) {
            _size -= _sizer.computeSize(entry);
            if (_remobs != null) {
                _remobs.removedFromMap(this, entry);
            }
        }
    }
369074
@MainThread
    public <S> void removeSource(@NonNull LiveData<S> toRemote) {
        Source<?> source = mSources.remove(toRemote);
        if (source != null) {
            source.unplug();
        }
    }
1082949
public boolean removeGuarded(Guarded toRemove) {
        Object mask = this.guardedEntries.remove(toRemove);
        return mask != null;
    }
496473
public void removeAttachment(IAtomBase toRemove) throws CTKException {

    Map<String, IAtomBase> groups = getRgroups();
    for (String key : groups.keySet()) {

      if (groups.get(key).compare(toRemove)) {
        for (int i = 0; i < attachments.size(); i++) {
          if (attachments.get(i).getLabel().equals(key)) {
            attachments.remove(i);
            break;
          }
        }
      }
    }
  }
1051251
function addonsManager_removeAddon(aSpec) {
    var spec = aSpec || { };
    spec.button = "remove";

    var button = this.getAddonButton(spec);
    this._controller.click(button);
  }
825594
private void moveWindow(int start_offset) throws IOException {
        if (start_offset != _window_low) { // only when we have to move

            int end_offset = start_offset + _window_size;
            // new window low/high = start_offset/end_offset
            int dirty_low = _file_high;
            int dirty_high = _write_pos;
            int dirty_len = _write_pos - _file_high;
            if (dirty_len > 0) {   // we need to be concerned at all about dirty data.
                // will any part of dirty data be moved out of window?
                if ( (dirty_low < start_offset) || (dirty_high > end_offset) ) {
                    // yes, dirty data need to be saved.
                    writeToTempFile(dirty_low, _memory_buffer, dirty_low - _window_low, dirty_len);
                }
            }
            
            // reposition any data from old window that will be also in new window:
            
            int stay_low = max(start_offset,_window_low);
            int stay_high = min(_write_pos, _window_high, end_offset);
            // is there anything to preserve?
            int stay_size = stay_high - stay_low;
            if (stay_size > 0) {
                System.arraycopy(_memory_buffer, stay_low-_window_low, _memory_buffer, stay_low-start_offset, stay_size);
            }
            
            // read in available data that were not in old window:
            if (stay_low > start_offset) {
                // read at the start of buffer
                int toread_low = start_offset;
                int toread_high = min(stay_low,end_offset);
                int toread_size = toread_high - toread_low;
                if (toread_size > 0) {
                    readFromTempFile(toread_low, _memory_buffer, toread_low-start_offset, toread_size);
                }
            }
            if (stay_high < end_offset) {
                // read at end of buffer
                int toread_low = max(stay_high,start_offset);
                int toread_high = min(end_offset,_file_high);
                int toread_size = toread_high-toread_low;
                if (toread_size > 0) {
                    readFromTempFile(toread_low, _memory_buffer, toread_low-start_offset, toread_size);
                }
            }
            _window_low = start_offset;
            _window_high = end_offset;
        }
    }
65878
@SuppressWarnings("unchecked")
    public A addAll(Iterable<Property> toAdd) {
        Data data = getData();
        Data modified = data.addAll(toAdd);
        if (data == modified) {
            return (A)this;
        }

        return copy(delegate.put("data", Property.toArrayNode(data)));
    }
619445
public void remove(final CompositeBinding b) {
        if (!disposedInd) {
            boolean unsubscribe = false;
            if (compBindings == null) {
                return;
            }
            unsubscribe = compBindings.remove(b);
            if (unsubscribe) {
                // if we removed successfully we then need to call dispose on it
                b.dispose();
            }
        }
    }
24916
public void purge(String cacheKey) {
        try {
            if (useMemoryCache) {
                if (memoryCache != null) {
                    memoryCache.remove(cacheKey);
                }
            }

            if (useDiskCache) {
                if (diskLruCache != null) {
                    diskLruCache.remove(cacheKey);
                }
            }
        } catch (Exception e) {
            Log.w(TAG, "Could not remove entry in cache purge", e);
        }
    }
866145
public void remove(Object data, int iOpenMode) throws DBException, RemoteException
    {
        synchronized(m_objSync)
        {
            m_tableRemote.remove(data, iOpenMode);
        }
    }
645082
function unmerge(toRemove) {
    var cy = this._private.cy;

    if (!toRemove) {
      return this;
    }

    if (toRemove && string(toRemove)) {
      var selector = toRemove;
      toRemove = cy.mutableElements().filter(selector);
    }

    for (var i = 0; i < toRemove.length; i++) {
      this.unmergeOne(toRemove[i]);
    }

    return this; // chaining
  }