Skip to content

Commit 7ff9ec6

Browse files
lingjun-cgDamonFool
authored andcommitted
8333462: Performance regression of new DecimalFormat() when compare to jdk11
Backport-of: d826127970bd2ae8bf4cacc3c55634dc5af307c4
1 parent b15ec4a commit 7ff9ec6

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, 2022, 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
@@ -849,10 +849,13 @@ private void initialize( Locale locale ) {
849849
* Obtains non-format single character from String
850850
*/
851851
private char findNonFormatChar(String src, char defChar) {
852-
return (char)src.chars()
853-
.filter(c -> Character.getType(c) != Character.FORMAT)
854-
.findFirst()
855-
.orElse(defChar);
852+
for (int i = 0; i < src.length(); i++) {
853+
char c = src.charAt(i);
854+
if (Character.getType(c) != Character.FORMAT) {
855+
return c;
856+
}
857+
}
858+
return defChar;
856859
}
857860

858861
/**

0 commit comments

Comments
 (0)