title: How to fix only last line of array being checked for username and password when read from a file
body: <p>I am reading usernames from a csv file in the format </p>
  
  <pre><code>admin1, apple,  admin
  staff1, orange, staff
  </code></pre>
  
  <p>with staff1 being on a new line and no matter how many lines I have, only the last line will be checked when login is occurring.</p>
  
  <pre><code>        AtomicBoolean found = new AtomicBoolean(false);
  
     btnLogin.setOnAction(e -&gt; {
          while (in.hasNextLine()) {
  
  
              String s = in.nextLine().replaceAll("\\s+", "");
  
  
  
  
  
                  if (name.equals(sArray[0]) &amp;&amp; password.equals(sArray[1])) {
                      lMessage.setText("correct");
                      openMainForm();
  
  
                  } else if (name.equals("") || password.equals("")) {
                      lMessage.setText("Please enter a username and password");
  
  
                  } else {
                      lMessage.setText("Please enter valid credentials");
  
  
  
                  }
  
  
  
  
              }
  
  
          });
  </code></pre>
  
  <p>I expect that if the username and password combination is found in the file they will be able to login and not just if the username and password is the last in the time</p>