private Reference2ReferenceOpenHashMap<T, U> init(
            AbstractOptions<T, U> baseOptions,
            Iterable<? extends AbstractOptionValue<?, ?, ?>> additionalValues) {

        // Use cheaper Iterable if possible.
        if (additionalValues instanceof AbstractOptions) {
            @SuppressWarnings("unchecked")
            final Reference2ReferenceOpenHashMap<T, U> additionalValueMap =
                    ((AbstractOptions<T, U>) additionalValues).valueMap;
            additionalValues = additionalValueMap.values();
        }

        // Merge all options.
        final Reference2ReferenceOpenHashMap<T, U> map = baseOptions.valueMap.clone();
        for (final AbstractOptionValue<?, ?, ?> value : additionalValues) {
            @SuppressWarnings("unchecked")
            final U newValue = (U) value;
            final T option = newValue.option();
            final U oldValue = map.putIfAbsent(option, newValue);
            if (oldValue != null) {
                map.put(option, option.merge(oldValue, newValue));
            }
        }
        return map;
    }
Creates a new instance.

@param baseOptions the base options to merge
@param additionalValues the option values
core/src/main/java/com/linecorp/armeria/common/util/AbstractOptions.java