public static List<String> readFileToList(String filePath){
  File file=new File(filePath);
  List<String> fileContent=new ArrayList<String>();
  if (file == null || !file.isFile()) {
    return null;
  }
  BufferedReader reader=null;
  try {
    reader=new BufferedReader(new FileReader(file));
    String line=null;
    while ((line=reader.readLine()) != null) {
      fileContent.add(line);
    }
    reader.close();
    return fileContent;
  }
 catch (  IOException e) {
    throw new RuntimeException("IOException occurred. ",e);
  }
 finally {
    if (reader != null) {
      try {
        reader.close();
      }
 catch (      IOException e) {
        throw new RuntimeException("IOException occurred. ",e);
      }
    }
  }
}

public static List < String > readFileToList ( String filePath ) { File file = new File ( filePath ) ; List < String > fileContent = new ArrayList < String > ( ) ; if ( file == null || ! file . isFile ( ) ) { return null ; } BufferedReader reader = null ; try { reader = new BufferedReader ( new FileReader ( file ) ) ; String line = null ; while ( ( line = reader . readLine ( ) ) != null ) { fileContent . add ( line ) ; } reader . close ( ) ; return fileContent ; } catch ( IOException e ) { throw new RuntimeException ( "IOException occurred. " , e ) ; } finally { if ( reader != null ) { try { reader . close ( ) ; } catch ( IOException e ) { throw new RuntimeException ( "IOException occurred. " , e ) ; } } } }
read file to string list , a element of list is a line
