common_helper/src/main/java/com/xiongyingqi/util/MimeTypeUtils.java
public static void sortBySpecificity(List<MimeType> mimeTypes) {
        Assert.notNull(mimeTypes, "'mimeTypes' must not be null");
        if (mimeTypes.size() > 1) {
            Collections.sort(mimeTypes, SPECIFICITY_COMPARATOR);
        }
    }
public static void sortBySpecificity(List<MimeType> mimeTypes) {
        Assert.notNull(mimeTypes, "'mimeTypes' must not be null");
        if (mimeTypes.size() > 1) {
            Collections.sort(mimeTypes, SPECIFICITY_COMPARATOR);
        }
    }
public static void sortBySpecificity ( List < MimeType > mimeTypes ) { Assert . notNull ( mimeTypes , "'mimeTypes' must not be null" ) ; if ( mimeTypes . size ( ) > 1 ) { Collections . sort ( mimeTypes , SPECIFICITY_COMPARATOR ) ; } }
Sorts the given list of {@code MimeType} objects by specificity.
<p>Given two mime types:
<ol>
<li>if either mime type has a {@linkplain MimeType#isWildcardType() wildcard type},
then the mime type without the wildcard is ordered before the other.</li>
<li>if the two mime types have different {@linkplain MimeType#getType() types},
then they are considered equal and remain their current order.</li>
<li>if either mime type has a {@linkplain MimeType#isWildcardSubtype() wildcard subtype}
, then the mime type without the wildcard is sorted before the other.</li>
<li>if the two mime types have different {@linkplain MimeType#getSubtype() subtypes},
then they are considered equal and remain their current order.</li>
<li>if the two mime types have a different amount of
{@linkplain MimeType#getParameter(String) parameters}, then the mime type with the most
parameters is ordered before the other.</li>
</ol>
<p>For example: <blockquote>audio/basic &lt; audio/* &lt; *&#047;*</blockquote>
<blockquote>audio/basic;level=1 &lt; audio/basic</blockquote>
<blockquote>audio/basic == text/html</blockquote> <blockquote>audio/basic ==
audio/wave</blockquote>

@param mimeTypes the list of mime types to be sorted
@see <a href="http://tools.ietf.org/html/rfc2616#section-14.1">HTTP 1.1, section
14.1</a>
Sorts the given list of { @code MimeType } objects by specificity . <p > Given two mime types : <ol > <li > if either mime type has a { @linkplain MimeType#isWildcardType () wildcard type } then the mime type without the wildcard is ordered before the other . < / li > <li > if the two mime types have different { @linkplain MimeType#getType () types } then they are considered equal and remain their current order . < / li > <li > if either mime type has a { @linkplain MimeType#isWildcardSubtype () wildcard subtype } then the mime type without the wildcard is sorted before the other . < / li > <li > if the two mime types have different { @linkplain MimeType#getSubtype () subtypes } then they are considered equal and remain their current order . < / li > <li > if the two mime types have a different amount of { @linkplain MimeType#getParameter ( String ) parameters } then the mime type with the most parameters is ordered before the other . < / li > < / ol > <p > For example : <blockquote > audio / basic &lt ; audio / * &lt ; * &#047 ; * < / blockquote > <blockquote > audio / basic ; level = 1 &lt ; audio / basic< / blockquote > <blockquote > audio / basic == text / html< / blockquote > <blockquote > audio / basic == audio / wave< / blockquote >