public override long UpdateValue(long key, long initialValueIfAbsent, LongToLongFunction function) { ++_modCount; if (IsSentinelKey(key)) { return(UpdateValueForSentinelKey(key, initialValueIfAbsent, function)); } //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int idx = indexOf(key); int idx = IndexOf(key); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long keyAtIdx = getKeyAt(idx); long keyAtIdx = GetKeyAt(idx); if (keyAtIdx == key) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long newValue = function.applyAsLong(getValueAt(idx)); long newValue = function.applyAsLong(GetValueAt(idx)); SetValueAt(idx, newValue); return(newValue); } if (keyAtIdx == REMOVED_KEY) { --_removals; } //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long value = function.applyAsLong(initialValueIfAbsent); long value = function.applyAsLong(initialValueIfAbsent); SetKeyAt(idx, key); SetValueAt(idx, value); ++_entriesInMemory; if (_entriesInMemory >= _resizeOccupancyThreshold) { GrowAndRehash(); } return(value); }
private long UpdateValueForSentinelKey(long key, long initialValueIfAbsent, LongToLongFunction function) { if (key == EMPTY_KEY) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long newValue = function.applyAsLong(hasZeroKey ? zeroValue : initialValueIfAbsent); long newValue = function.applyAsLong(_hasZeroKey ? _zeroValue : initialValueIfAbsent); _hasZeroKey = true; _zeroValue = newValue; return(newValue); } if (key == REMOVED_KEY) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long newValue = function.applyAsLong(hasOneKey ? oneValue : initialValueIfAbsent); long newValue = function.applyAsLong(_hasOneKey ? _oneValue : initialValueIfAbsent); _hasOneKey = true; _oneValue = newValue; return(newValue); } throw new AssertionError("Invalid sentinel key: " + key); }