Monday, 20 May 2013

java - for loop declaration

java - for loop declaration

I'm only familier with the normal for loop declaration. Can anybody tell me what these for-loops are doing and how their conditions work?
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;
                    }
                }
            }

No comments:

Post a Comment