diff --git a/drv/AbstractMap.drv b/drv/AbstractMap.drv index 6bf47f0d..f150105b 100644 --- a/drv/AbstractMap.drv +++ b/drv/AbstractMap.drv @@ -105,10 +105,10 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC extends ABSTRACT_FUNCTION K #if VALUES_INT_LONG_DOUBLE /** {@inheritDoc} * @implSpec This method just delegates to the interface default method, - * as the default method, but it is final, so it cannot be overridden. + * as the default method. */ @Override - public final VALUE_TYPE MERGE_VALUE(final KEY_GENERIC_TYPE key, final VALUE_TYPE value, final VALUE_PACKAGE.VALUE_BINARY_OPERATOR remappingFunction) { + public VALUE_TYPE MERGE_VALUE(final KEY_GENERIC_TYPE key, final VALUE_TYPE value, final VALUE_PACKAGE.VALUE_BINARY_OPERATOR remappingFunction) { return MERGE_VALUE(key, value, (JDK_PRIMITIVE_VALUE_BINARY_OPERATOR)remappingFunction); } #endif diff --git a/drv/OpenHashMap.drv b/drv/OpenHashMap.drv index 3d3de447..254b3be3 100644 --- a/drv/OpenHashMap.drv +++ b/drv/OpenHashMap.drv @@ -36,6 +36,7 @@ import VALUE_PACKAGE.VALUE_COLLECTION; import VALUE_PACKAGE.VALUE_ABSTRACT_COLLECTION; #if VALUES_PRIMITIVE +import VALUE_PACKAGE.VALUE_BINARY_OPERATOR; import VALUE_PACKAGE.VALUE_ITERATOR; import VALUE_PACKAGE.VALUE_SPLITERATOR; import VALUE_PACKAGE.VALUE_SPLITERATORS; @@ -1253,6 +1254,26 @@ public class OPEN_HASH_MAP KEY_VALUE_GENERIC extends ABSTRACT_MAP KEY_VALUE_GENE return value[pos] = newVal; } +#if VALUES_INT_LONG_DOUBLE + /** {@inheritDoc} */ + @Override + public VALUE_GENERIC_TYPE MERGE_VALUE(final KEY_GENERIC_TYPE k, final VALUE_GENERIC_TYPE v, VALUE_BINARY_OPERATOR remappingFunction) { + java.util.Objects.requireNonNull(remappingFunction); + REQUIRE_VALUE_NON_NULL(v) + + final int pos = find(k); + if (pos < 0) { + insert(-pos - 1, k, v); + return v; + } + + final VALUE_GENERIC_TYPE newValue = remappingFunction.apply(value[pos], v); + + return value[pos] = newValue; + } + +#endif + /** {@inheritDoc} */ @Override public VALUE_GENERIC_TYPE merge(final KEY_GENERIC_TYPE k, final VALUE_GENERIC_TYPE v, final java.util.function.BiFunction remappingFunction) {