mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8197829: Optimize CLDRCalendarDataProviderImpl::retrieveInteger
Reviewed-by: naoto
This commit is contained in:
parent
06a9e1a72f
commit
50f6694f00
1 changed files with 6 additions and 5 deletions
|
@ -97,10 +97,11 @@ public class CLDRCalendarDataProviderImpl extends CalendarDataProviderImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Optional<Integer> retrieveInteger(String src, String region) {
|
private static Optional<Integer> retrieveInteger(String src, String region) {
|
||||||
return Arrays.stream(src.split(";"))
|
int regionIndex = src.indexOf(region);
|
||||||
.filter(entry -> entry.contains(region))
|
if (regionIndex >= 0) {
|
||||||
.map(entry -> entry.substring(0, entry.indexOf(":")))
|
int start = src.lastIndexOf(';', regionIndex) + 1;
|
||||||
.findAny()
|
return Optional.of(Integer.parseInt(src, start, src.indexOf(':', start), 10));
|
||||||
.map(Integer::parseInt);
|
}
|
||||||
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue