private void mergeWith(DebugValueMap map) { if (map.hasChildren()) { if (hasChildren()) { children.addAll(map.children); } else { children = map.children; } map.children = null; } int size = Math.max(this.capacity(), map.capacity()); ensureSize(size); for (int i = 0; i < size; ++i) { long curValue = getCurrentValue(i); long otherValue = map.getCurrentValue(i); setCurrentValue(i, curValue + otherValue); } }