public void load ( File file , boolean ids ) throws IOException , FileNotFoundException { LineNumberReader in = new LineNumberReader ( new FileReader ( file ) ) ; String line ; while ( ( line = in . readLine ( ) ) != null ) { if ( ids ) put ( Integer . toString ( in . getLineNumber ( ) ) , line , line ) ; else put ( line , line ) ; } in . close ( ) ; }
Insert all lines in a file as items mapping to themselves . If ids is true then make the line number of an item its id .