title: How to skip the NULL line in java?
body: <p>My program need to read .txt file and store it in to Arraylist.</p>
  
  <p>But readLine() Stop reading after finishing  A , B , and got Error ( when reading Blankline everything return NULL and got outbound exception)</p>
  
  <p>.txt file</p>
  
  <p>A
  B</p>
  
  <p>C</p>
  
  <p>D
  E</p>
  
  <p>Does its possible to read , skipping blankline , read again , detect blankline and skip it again ....... </p>
  
  <pre><code>    public static void loadData(){
      try{
          BufferedReader rd = new BufferedReader (new FileReader("/Users/Homura/Documents/newWorkspace/DataStructures/src/flights.txt"));
  
      while(true){
  
          String myLine = rd.readLine();
          String fName = myLine.substring(0,myLine.indexOf("-&gt;",0));
          String toName = myLine.substring(myLine.indexOf("-&gt;")+3);
  
          if(!myMap.containsKey(fName)){
             ArrayList&lt;String&gt; myArray = new ArrayList&lt;String&gt;();
             myMap.put(fName,myArray); 
          }
          myMap.get(fName).add(toName);
          allPlaces.add(fName);
  
          if(rd.readLine()== null) { myLine = rd.readLine();
         }
      }
      }
  
      catch(IOException ex){
          throw new ErrorException(ex);
      }
  }
  </code></pre>