public int merge(final K key, final int value, final IntIntFunction remappingFunction)
    {
        requireNonNull(key);
        requireNonNull(remappingFunction);
        final int missingValue = this.missingValue;
        if (missingValue == value)
        {
            throw new IllegalArgumentException("cannot accept missingValue");
        }

        final K[] keys = this.keys;
        final int[] values = this.values;
        @DoNotSub final int mask = values.length - 1;
        @DoNotSub int index = Hashing.hash(key, mask);

        int oldValue;
        while (missingValue != (oldValue = values[index]))
        {
            if (Objects.equals(keys[index], key))
            {
                break;
            }

            index = ++index & mask;
        }

        final int newValue = missingValue == oldValue ? value : remappingFunction.apply(oldValue, value);
        if (missingValue != newValue)
        {
            keys[index] = key;
            values[index] = newValue;
            if (++size > resizeThreshold)
            {
                increaseCapacity();
            }
        }
        else
        {
            keys[index] = null;
            values[index] = missingValue;
            --size;
            compactChain(index);
        }
        return newValue;
    }
@Test
    void mergeThrowsNullPointerExceptionIfRemappingFunctionIsNull()
    {
        assertThrowsExactly(NullPointerException.class, () -> objectToIntMap.merge("key", 42, null));
    }