< prev index next >
src/java.base/share/classes/sun/util/locale/LocaleMatcher.java
Print this page
rev 51919 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: dfuchs, alanb
@@ -400,11 +400,11 @@
if (range.equals("*")) {
continue;
}
String rangeForRegex = range.replace("*", "\\p{Alnum}*");
- while (rangeForRegex.length() > 0) {
+ 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,11 +435,11 @@
if (range.equals("*")) {
continue;
}
String rangeForRegex = range.replace("*", "\\p{Alnum}*");
- while (rangeForRegex.length() > 0) {
+ while (!rangeForRegex.isEmpty()) {
if (tag.matches(rangeForRegex)) {
return true;
}
// Truncate from the end....
rangeForRegex = truncateRange(rangeForRegex);
@@ -589,11 +589,11 @@
}
private static String[] getEquivalentsForLanguage(String range) {
String r = range;
- while (r.length() > 0) {
+ 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,11 +678,11 @@
for (LanguageRange lr : priorityList) {
String range = lr.getRange();
String r = range;
boolean hasEquivalent = false;
- while (r.length() > 0) {
+ 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 >