Clears all deleted and inserted objects from the cache,
and removes inserts and deletes that cancel each other.
<p>
Also removes deletes with duplicate ids.
519778
protected void removeUnnecessaryOperations() {

        for (Class<? extends Entity> entityClass : deletedObjects.keySet()) {

            // Collect ids of deleted entities + remove duplicates
            Set<String> ids = new HashSet<String>();
            Iterator<Entity> entitiesToDeleteIterator = deletedObjects.get(entityClass).values().iterator();
            while (entitiesToDeleteIterator.hasNext()) {
                Entity entityToDelete = entitiesToDeleteIterator.next();
                if (!ids.contains(entityToDelete.getId())) {
                    ids.add(entityToDelete.getId());
                } else {
                    entitiesToDeleteIterator.remove(); // Removing duplicate deletes
                }
            }

            // Now we have the deleted ids, we can remove the inserted objects (as they cancel each other)
            for (String id : ids) {
                if (insertedObjects.containsKey(entityClass) && insertedObjects.get(entityClass).containsKey(id)) {
                    insertedObjects.get(entityClass).remove(id);
                    deletedObjects.get(entityClass).remove(id);
                }
            }
        }
    }
299848
public void clear() {
        documentsByEntity.clear();
        deletedEntities.clear();
        documentsById.clear();
        _knownMissingIds.clear();
        if (_countersByDocId != null) {
            _countersByDocId.clear();
        }
    }
1318752
public synchronized void clear() {
		try {
			super.clear();
			list.clear();
		} catch (Exception e) {
			log.log(Level.SEVERE, "clear cache: ", e);
		}
	}
1274451
public void clear()
  {
    for (int i = 0; i < _values.length; i++) {
      _keys[i] = null;
      _values[i] = 0;
    }
    
    _size = 0;
  }
72294
@Override
    public void clear() {
        if (mSize != 0) {
            freeArrays(mHashes, mArray, mSize);
            mHashes = ContainerHelpers.EMPTY_INTS;
            mArray = ContainerHelpers.EMPTY_OBJECTS;
            mSize = 0;
        }
    }
772332
public void purgeCache() {
        synchronized (users) {
            users.values().stream()
                    .map(Reference::get)
                    .filter(Objects::nonNull)
                    .map(Cleanupable.class::cast)
                    .forEach(Cleanupable::cleanup);
            users.clear();
        }
        userIdByRef.clear();
        servers.values().stream()
                .map(Cleanupable.class::cast)
                .forEach(Cleanupable::cleanup);
        servers.clear();
        channels.values().stream()
                .filter(Cleanupable.class::isInstance)
                .map(Cleanupable.class::cast)
                .forEach(Cleanupable::cleanup);
        channels.clear();
        unavailableServers.clear();
        customEmojis.clear();
        messages.clear();
        messageIdByRef.clear();
        timeOffset = null;
    }
1258056
public function clear()
    {
        if (null !== $this->aSkillRelatedByPartId) {
            $this->aSkillRelatedByPartId->removePart($this);
        }
        if (null !== $this->aSkillRelatedByCompositeId) {
            $this->aSkillRelatedByCompositeId->removeComposite($this);
        }
        $this->part_id = null;
        $this->composite_id = null;
        $this->alreadyInSave = false;
        $this->clearAllReferences();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }
679666
public function clearAll()
    {
        $prefixes = Cache::configured();
        foreach ($prefixes as $prefix) {
            $this->clear($prefix);
        }
    }
1363251
public function clear()
    {
        $this->id = null;
        $this->locale = null;
        $this->description = null;
        $this->alreadyInSave = false;
        $this->clearAllReferences();
        $this->applyDefaultValues();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }
822592
public void clear()
    {
        Iterator it = cachesByClass.values().iterator();
        while (it.hasNext())
        {
            ObjectCache cache = (ObjectCache) it.next();
            if (cache != null)
            {
                cache.clear();
            }
        }
    }
146301
public void clear()
    {
        final Object[] keys = _keys;
        final int[] values = _values;

        for (int i = keys.length - 1; i >= 0; i--) {
            keys[i] = null;
            values[i] = 0;
        }

        _size = 0;
    }
1226052
public function clear()
    {
        unset($this->cc);
        unset($this->bcc);
        unset($this->receivers);
        unset($this->attachments);
        unset($this->contentHTML);
        unset($this->contentPlain);
    }
1232177
synchronized void cleanUp() {

        updateAccessCounts();

        int                          removeCount = size() / 2;
        int accessTarget = getAccessCountCeiling(removeCount, removeCount / 8);
        BaseHashMap.BaseHashIterator it          = new BaseHashIterator();
        int                          savecount   = 0;

        for (; it.hasNext(); ) {
            CachedObject r = (CachedObject) it.next();

            if (it.getAccessCount() <= accessTarget) {
                synchronized (r) {
                    if (!r.isKeepInMemory()) {
                        r.setInMemory(false);

                        if (r.hasChanged()) {
                            rowTable[savecount++] = r;
                        }

                        it.remove();

                        cacheBytesLength -= r.getStorageSize();

                        removeCount--;
                    }
                }
            }
        }

        if (removeCount > 50) {
            it = new BaseHashIterator();

            for (; removeCount >= 0 && it.hasNext(); ) {
                CachedObject r = (CachedObject) it.next();

                if (!r.isKeepInMemory()) {
                    r.setInMemory(false);

                    if (r.hasChanged()) {
                        rowTable[savecount++] = r;
                    }

                    it.remove();

                    cacheBytesLength -= r.getStorageSize();

                    removeCount--;
                }
            }
        }

        super.setAccessCountFloor(accessTarget);
        saveRows(savecount);
    }
707245
private function clearAllCaches()
    {
        $this->clearCache(self::CACHE_KEY_CSS);
        $this->clearCache(self::CACHE_KEY_SELECTOR);
        $this->clearCache(self::CACHE_KEY_XPATH);
        $this->clearCache(self::CACHE_KEY_CSS_DECLARATIONS_BLOCK);
        $this->clearCache(self::CACHE_KEY_COMBINED_STYLES);
    }
1276329
public void clear() {
		//clear each collection to make previously returned lists empty
		for (List<V> value : map.values()) {
			value.clear();
		}
		map.clear();
	}
539569
public void clear() {

        if (m_originalItems != null) {
            m_originalItems.clear();
        }
        m_filteredItems = null;
        synchronized (this) {
            if (m_visibleItems != null) {
                m_visibleItems.clear();
            }
        }
        setSearchFilter("");
        m_sortedColumn = null;
    }
799518
public void clear ()
    {
        // notify our removal observer if we have one
        if (_remobs != null) {
            for (Iterator<V> iter = _delegate.values().iterator();
                 iter.hasNext(); ) {
                _remobs.removedFromMap(this, iter.next());
            }
        }

        // then clear everything out
        _delegate.clear();
        _size = 0;
    }