private static MediaType create(
            String type, String subtype, Multimap<String, String> parameters) {
        checkNotNull(type);
        checkNotNull(subtype);
        checkNotNull(parameters);
        String normalizedType = normalizeToken(type);
        String normalizedSubtype = normalizeToken(subtype);
        checkArgument(
                !WILDCARD.equals(normalizedType) || WILDCARD.equals(normalizedSubtype),
                "A wildcard type cannot be used with a non-wildcard subtype");
        ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder();
        for (Entry<String, String> entry : parameters.entries()) {
            String attribute = normalizeToken(entry.getKey());
            builder.put(attribute, normalizeParameterValue(attribute, entry.getValue()));
        }
        MediaType mediaType = new MediaType(normalizedType, normalizedSubtype, builder.build());
        // Return one of the constants if the media type is a known type.
        return firstNonNull(KNOWN_TYPES.get(mediaType), mediaType);
    }
Creates a new media type with the given type and subtype.

@throws IllegalArgumentException if type or subtype is invalid or if a wildcard is used for the
    type, but not the subtype.
core/src/main/java/com/linecorp/armeria/common/MediaType.java