public static List<MediaType> parseMediaTypes(String mediaTypes) {
        if (StringUtils.isEmpty(mediaTypes)) {
            return Collections.emptyList();
        }
        String[] tokens = StringUtils.tokenizeToStringArray(mediaTypes, ",");
        List<MediaType> result = new ArrayList<>(tokens.length);
        for (String token : tokens) {
            result.add(parseMediaType(token));
        }
        return result;
    }
public static List < MediaType > parseMediaTypes ( String mediaTypes ) { if ( StringUtils . isEmpty ( mediaTypes ) ) { return Collections . emptyList ( ) ; } String [ ] tokens = StringUtils . tokenizeToStringArray ( mediaTypes , "," ) ; List < MediaType > result = new ArrayList < > ( tokens . length ) ; for ( String token : tokens ) { result . add ( parseMediaType ( token ) ) ; } return result ; }
Parse the given comma-separated string into a list of {@code MediaType} objects.

<p>This method can be used to parse an Accept or Content-Type header.

@param mediaTypes the string to parse.

@return the list of media types.

@throws InvalidMediaTypeException if the media type value cannot be parsed.