我只熟悉普通的 for 循环声明。谁能告诉我这些 for 循环在做什么以及它们的条件如何工作?
BufferedReader charSource = Files.newBufferedReader(this.sourcePath, Charset.forName("ISO-8859-2");
BufferedWriter charSink = Files.newBufferedWriter(this.targetPath, Charset.forName("ISO-8859-2");
for (String line = charSource.readLine(); line != null; line = charSource.readLine()) {
for (final String element : line.split("\\s")) {
if (!element.isEmpty()) {
this.streamSorter.write(element);
elementCount += 1;
}
}
}