public void replace(RegionEntry entry, Object values) {
      int numOldValues = getNumValues(entry);
      map.put(entry, values);
      atomicUpdater.addAndGet(this,
          (values instanceof Collection ? ((Collection) values).size() : 1) - numOldValues);
    }
This replaces a key's value along with updating the numValues correctly.
geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractIndex.java