public static List < String > readToList ( Reader r ) throws IOException { try ( BufferedReader in = new BufferedReader ( r ) ) { List < String > l = new ArrayList <> ( ) ; String line = null ; while ( ( line = in . readLine ( ) ) != null ) l . add ( line ) ; return Collections . unmodifiableList ( l ) ; } }
Read the Reader line for line and return the result in a list