code: public static Map<Locale, QualityValue> getLocaleQualityValues(String header)
     {
        Map<String, QualityValue> stringResult = getStringQualityValues(header);
        if (stringResult == null)
           return null;
        Map<Locale, QualityValue> result = new LinkedHashMap<Locale, QualityValue>(stringResult.size() * 2);
  
        for (Entry<String, QualityValue> entry : stringResult.entrySet())
        {
           QualityValue quality = entry.getValue();
           Locale locale = null;
           String value = entry.getKey();
           if (value != null)
           {
              int length = value.length();
              if (length == 2)
              {
                 locale = new Locale(value);
              }
              else if (length == 5 && value.charAt(2) == '-')
              {
                 String language = value.substring(0, 2);
                 String country = value.substring(3, 5);
                 locale = new Locale(language, country);
              }
              else
              {
                 logger.debug("Ignoring unsupported locale: " + value);
                 continue;
              }
           }
           result.put(locale, quality);
        }
  
        if (logger.isDebugEnabled())
           logger.debug(result.toString());
        return result;
     }
docs: Gets the locales from a comma-separated list.
  Any "*" entries are replaced with {@code null} keys.
  
  @param header the header value.
  @return the listed items in order of appearance or {@code null} if the header didn't contain any entries.