Skip to content

Commit

Permalink
while Character.isWhiteSpace
Browse files Browse the repository at this point in the history
  • Loading branch information
datdenkikniet committed Jan 6, 2024
1 parent 06c1635 commit 0e2814e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/dev/morling/onebrc/WeatherStationFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ public static List<WeatherStation> getWeatherStationsList(long seed) throws Exce
var nameBuf = new StringBuilder(nameLen);
nameBuf.append(buf, 0, nameLen);

if (Character.isWhitespace(nameBuf.charAt(0))) {
while (Character.isWhitespace(nameBuf.charAt(0))) {
nameBuf.setCharAt(0, readNonSpace(nameSource));
}
if (Character.isWhitespace(nameBuf.charAt(nameBuf.length() - 1))) {
while (Character.isWhitespace(nameBuf.charAt(nameBuf.length() - 1))) {
nameBuf.setCharAt(nameBuf.length() - 1, readNonSpace(nameSource));
}

Expand Down Expand Up @@ -141,7 +141,7 @@ private static char readNonSpace(StringReader nameSource) throws Exception {
throw new Exception("Name source exhausted");
}
c = (char) n;
} while (c == ' ');
} while (Character.isWhitespace(c));

return c;
}
Expand Down

0 comments on commit 0e2814e

Please sign in to comment.