title: Iterating over the content of a text file line by line - is there a best practice? (vs. PMD's AssignmentInOperand)
body: <p>We have a Java Application that has a few modules that know to read text files. They do it quite simply with a code like this:</p>
  
  <pre><code>BufferedReader br = new BufferedReader(new FileReader(file));  
  String line = null;  
  while ((line = br.readLine()) != null)  
  {  
     ... // do stuff to file here  
  } 
  </code></pre>
  
  <p>I ran <strong>PMD</strong> on my project and got the '<strong>AssignmentInOperand</strong>' violation on the <code>while (...)</code> line.</p>
  
  <p>Is there a simpler way of doing this loop other than the obvious:    </p>
  
  <pre><code>String line = br.readLine();  
  while (line != null)  
  {  
     ... // do stuff to file here  
     line = br.readLine();  
  } 
  </code></pre>
  
  <p>Is this considered a better practice? (although we "duplicate" the <code>line = br.readLine()</code> code?)</p>