in locales-utils/src/main/java/com/spotify/i18n/locales/utils/acceptlanguage/AcceptLanguageUtils.java [85:95]
private static List<LanguageRange> parseGivenValue(final String acceptLanguage) {
return Optional.ofNullable(acceptLanguage)
.map(AcceptLanguageUtils::sanitizeAcceptLanguage)
.filter(Predicate.not(String::isEmpty))
.map(AcceptLanguageUtils::parseSanitizedValue)
.orElse(Collections.emptyList())
.stream()
.sorted(Comparator.comparing(LanguageRange::getWeight).reversed())
.distinct()
.collect(Collectors.toList());
}