changeset 49073:99b94636fcd3

8197829: Optimize CLDRCalendarDataProviderImpl::retrieveInteger Reviewed-by: naoto
author redestad
date Wed, 14 Feb 2018 14:45:38 +0100
parents 454518b338b0
children 7a1916641c0c
files src/java.base/share/classes/sun/util/cldr/CLDRCalendarDataProviderImpl.java
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/sun/util/cldr/CLDRCalendarDataProviderImpl.java	Wed Feb 14 16:58:49 2018 +0800
+++ b/src/java.base/share/classes/sun/util/cldr/CLDRCalendarDataProviderImpl.java	Wed Feb 14 14:45:38 2018 +0100
@@ -97,10 +97,11 @@
     }
 
     private static Optional<Integer> retrieveInteger(String src, String region) {
-        return Arrays.stream(src.split(";"))
-            .filter(entry -> entry.contains(region))
-            .map(entry -> entry.substring(0, entry.indexOf(":")))
-            .findAny()
-            .map(Integer::parseInt);
+        int regionIndex = src.indexOf(region);
+        if (regionIndex >= 0) {
+            int start = src.lastIndexOf(';', regionIndex) + 1;
+            return Optional.of(Integer.parseInt(src, start, src.indexOf(':', start), 10));
+        }
+        return Optional.empty();
     }
 }