< prev index next >
src/java.base/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java
Print this page
rev 59021 : 8244152: Remove unnecessary hash map resize in LocaleProviderAdapters
Reviewed-by: joehw, vtewari
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -222,12 +222,12 @@
}
}
if (supportedLocaleString == null) {
return Collections.emptySet();
}
- Set<String> tagset = new HashSet<>();
StringTokenizer tokens = new StringTokenizer(supportedLocaleString);
+ Set<String> tagset = new HashSet<>(Math.max((int)(tokens.countTokens() / 0.75f) + 1, 16));
while (tokens.hasMoreTokens()) {
tagset.add(tokens.nextToken());
}
return tagset;
}
< prev index next >