Skip to content

Commit 0e2814e

Browse files
committed
while Character.isWhiteSpace
1 parent 06c1635 commit 0e2814e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/dev/morling/onebrc/WeatherStationFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ public static List<WeatherStation> getWeatherStationsList(long seed) throws Exce
8383
var nameBuf = new StringBuilder(nameLen);
8484
nameBuf.append(buf, 0, nameLen);
8585

86-
if (Character.isWhitespace(nameBuf.charAt(0))) {
86+
while (Character.isWhitespace(nameBuf.charAt(0))) {
8787
nameBuf.setCharAt(0, readNonSpace(nameSource));
8888
}
89-
if (Character.isWhitespace(nameBuf.charAt(nameBuf.length() - 1))) {
89+
while (Character.isWhitespace(nameBuf.charAt(nameBuf.length() - 1))) {
9090
nameBuf.setCharAt(nameBuf.length() - 1, readNonSpace(nameSource));
9191
}
9292

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

146146
return c;
147147
}

0 commit comments

Comments
 (0)