@VisibleForTesting static int compareMediaType(MediaType m1, MediaType m2) { // The order should be "q=1.0, q=0.5". // To ensure descending order, we pass the q values of m2 and m1 respectively. final int qCompare = Float.compare(m2.qualityFactor(), m1.qualityFactor()); if (qCompare != 0) { return qCompare; } // The order should be "application/*, */*". final int wildcardCompare = Integer.compare(m1.numWildcards(), m2.numWildcards()); if (wildcardCompare != 0) { return wildcardCompare; } // Finally, sort by lexicographic order. ex, application/*, image/* return m1.type().compareTo(m2.type()); }
requireNonNull(range, "ranges contains null."); float qValue = range.qualityFactor(Float.NEGATIVE_INFINITY); final int numWildcards = range.numWildcards(); final int numParams; if (qValue < 0) {