--- old/src/java.base/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java 2020-04-30 08:20:08.000000000 -0700 +++ new/src/java.base/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java 2020-04-30 08:20:08.000000000 -0700 @@ -1,5 +1,5 @@ /* - * 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 @@ -224,8 +224,8 @@ if (supportedLocaleString == null) { return Collections.emptySet(); } - Set tagset = new HashSet<>(); StringTokenizer tokens = new StringTokenizer(supportedLocaleString); + Set tagset = new HashSet<>(Math.max((int)(tokens.countTokens() / 0.75f) + 1, 16)); while (tokens.hasMoreTokens()) { tagset.add(tokens.nextToken()); } --- old/src/java.base/share/classes/sun/util/locale/provider/JRELocaleProviderAdapter.java 2020-04-30 08:20:09.000000000 -0700 +++ new/src/java.base/share/classes/sun/util/locale/provider/JRELocaleProviderAdapter.java 2020-04-30 08:20:09.000000000 -0700 @@ -1,5 +1,5 @@ /* - * 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 @@ -444,8 +444,8 @@ if (supportedLocaleString == null) { return Collections.emptySet(); } - Set tagset = new HashSet<>(); StringTokenizer tokens = new StringTokenizer(supportedLocaleString); + Set tagset = new HashSet<>(Math.max((int)(tokens.countTokens() / 0.75f) + 1, 16)); while (tokens.hasMoreTokens()) { tagset.add(tokens.nextToken()); }