Skip to content

Commit d826127

Browse files
lingjun-cgD-D-H
authored andcommitted
8333462: Performance regression of new DecimalFormat() when compare to jdk11
Reviewed-by: liach, naoto, jlu
1 parent 67b9a08 commit d826127

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/java.base/share/classes/java/text/DecimalFormatSymbols.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -862,10 +862,13 @@ private void initialize( Locale locale ) {
862862
* Obtains non-format single character from String
863863
*/
864864
private char findNonFormatChar(String src, char defChar) {
865-
return (char)src.chars()
866-
.filter(c -> Character.getType(c) != Character.FORMAT)
867-
.findFirst()
868-
.orElse(defChar);
865+
for (int i = 0; i < src.length(); i++) {
866+
char c = src.charAt(i);
867+
if (Character.getType(c) != Character.FORMAT) {
868+
return c;
869+
}
870+
}
871+
return defChar;
869872
}
870873

871874
/**

0 commit comments

Comments
 (0)