@SafeVarargs
    @SuppressWarnings("varargs")
    public static <K, V> Map<K, V> ofEntries(Map.Entry<? extends K, ? extends V>... entries) {
        if (entries.length == 0) {
            return MapUtils.of();
        } else if (entries.length == 1) {
            return MapUtils.of(entries[0].getKey(), entries[0].getValue());
        } else {
            Map<K, V> result = new HashMap<>(entries.length);
            for (Map.Entry<? extends K, ? extends V> entry : entries) {
                result.put(entry.getKey(), entry.getValue());
            }
            return Collections.unmodifiableMap(result);
        }
    }
Creates an unmodifiable Map from an array of {@code Map.Entry} values.

@param entries Map entries to add to the created {@code Map}.
@param <K> Map key type.
@param <V> Map value type.
@return Returns an unmodifiable map of the given entries.
smithy-utils/src/main/java/software/amazon/smithy/utils/MapUtils.java