Skip to content
Permalink
Browse files

8244459: Optimize the hash map size in LocaleProviderAdapters

Reviewed-by: joehw, plevart, smarks
  • Loading branch information
Naoto Sato
Naoto Sato committed May 6, 2020
1 parent ed24927 commit 09287ab1ac2e0989231777a465ba2eed01a6daef
@@ -225,7 +225,7 @@ private static Locale applyAliases(Locale loc) {
return Collections.emptySet();
}
StringTokenizer tokens = new StringTokenizer(supportedLocaleString);
Set<String> tagset = new HashSet<>(Math.max((int)(tokens.countTokens() / 0.75f) + 1, 16));
Set<String> tagset = new HashSet<>((tokens.countTokens() * 4 + 2) / 3);
while (tokens.hasMoreTokens()) {
tagset.add(tokens.nextToken());
}
@@ -445,7 +445,7 @@ public LocaleData getLocaleData() {
return Collections.emptySet();
}
StringTokenizer tokens = new StringTokenizer(supportedLocaleString);
Set<String> tagset = new HashSet<>(Math.max((int)(tokens.countTokens() / 0.75f) + 1, 16));
Set<String> tagset = new HashSet<>((tokens.countTokens() * 4 + 2) / 3);
while (tokens.hasMoreTokens()) {
tagset.add(tokens.nextToken());
}

0 comments on commit 09287ab

Please sign in to comment.