Skip to content

Commit

Permalink
Replace contains(".") by indexOf('.') >= 0
Browse files Browse the repository at this point in the history
The usage of `indexOf(char)` is slightly faster
  • Loading branch information
Carlos Tasada committed May 13, 2024
1 parent e175533 commit 8dcfdd0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gson/src/main/java/com/google/gson/ToNumberPolicy.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public Number readNumber(JsonReader in) throws IOException {
@Override
public Number readNumber(JsonReader in) throws IOException, JsonParseException {
String value = in.nextString();
if (value.contains(".")) {
if (value.indexOf('.') >= 0) {
return parseAsDouble(value, in);
} else {
try {
Expand Down

0 comments on commit 8dcfdd0

Please sign in to comment.