The canonical readLine loop (null = end of file)
The canonical readLine loop (null = end of file)
Answer
String line; while ((line = in.readLine()) != null) { process(line); }
readLine() returns each line without its terminator and null at EOF. The condition assigns then tests against null in one expression.