< prev index next >

src/java.base/share/classes/sun/util/locale/LocaleMatcher.java

Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD

*** 400,410 **** if (range.equals("*")) { continue; } String rangeForRegex = range.replace("*", "\\p{Alnum}*"); ! while (rangeForRegex.length() > 0) { for (String tag : tags) { // change to lowercase for case-insensitive matching String lowerCaseTag = tag.toLowerCase(Locale.ROOT); if (lowerCaseTag.matches(rangeForRegex) && !shouldIgnoreLookupMatch(zeroRanges, lowerCaseTag)) { --- 400,410 ---- if (range.equals("*")) { continue; } String rangeForRegex = range.replace("*", "\\p{Alnum}*"); ! while (!rangeForRegex.isEmpty()) { for (String tag : tags) { // change to lowercase for case-insensitive matching String lowerCaseTag = tag.toLowerCase(Locale.ROOT); if (lowerCaseTag.matches(rangeForRegex) && !shouldIgnoreLookupMatch(zeroRanges, lowerCaseTag)) {
*** 435,445 **** if (range.equals("*")) { continue; } String rangeForRegex = range.replace("*", "\\p{Alnum}*"); ! while (rangeForRegex.length() > 0) { if (tag.matches(rangeForRegex)) { return true; } // Truncate from the end.... rangeForRegex = truncateRange(rangeForRegex); --- 435,445 ---- if (range.equals("*")) { continue; } String rangeForRegex = range.replace("*", "\\p{Alnum}*"); ! while (!rangeForRegex.isEmpty()) { if (tag.matches(rangeForRegex)) { return true; } // Truncate from the end.... rangeForRegex = truncateRange(rangeForRegex);
*** 589,599 **** } private static String[] getEquivalentsForLanguage(String range) { String r = range; ! while (r.length() > 0) { if (LocaleEquivalentMaps.singleEquivMap.containsKey(r)) { String equiv = LocaleEquivalentMaps.singleEquivMap.get(r); // Return immediately for performance if the first matching // subtag is found. return new String[]{replaceFirstSubStringMatch(range, --- 589,599 ---- } private static String[] getEquivalentsForLanguage(String range) { String r = range; ! while (!r.isEmpty()) { if (LocaleEquivalentMaps.singleEquivMap.containsKey(r)) { String equiv = LocaleEquivalentMaps.singleEquivMap.get(r); // Return immediately for performance if the first matching // subtag is found. return new String[]{replaceFirstSubStringMatch(range,
*** 678,688 **** for (LanguageRange lr : priorityList) { String range = lr.getRange(); String r = range; boolean hasEquivalent = false; ! while (r.length() > 0) { if (keyMap.containsKey(r)) { hasEquivalent = true; List<String> equivalents = map.get(keyMap.get(r)); if (equivalents != null) { int len = r.length(); --- 678,688 ---- for (LanguageRange lr : priorityList) { String range = lr.getRange(); String r = range; boolean hasEquivalent = false; ! while (!r.isEmpty()) { if (keyMap.containsKey(r)) { hasEquivalent = true; List<String> equivalents = map.get(keyMap.get(r)); if (equivalents != null) { int len = r.length();
< prev index next >