title: While loops always returns true in java
body: <p>My while loop returns true regardless of if he input is true or not. So it check if the director exists using the id method in dao. The while loop should end once this changes to false and the id does not exist. id starts at 1 for first iteration. d F Name and d S Name take in the first id of 1. If the current director names aren't equal to the new director being created, it should increment id by 1. If they don't not match, it should simply return &quot;true&quot;. If its the else option then that
  should just increment id by 1 again and go back into the loop. This should continue until the first Id that does not exist, or a duplicate name is found.</p>
  <p>It seems to me that it isn't running if statement conditional in the very first if statement and skipping straight to the if statement nested inside the first. I've tried chaging around the loop, using do... while(), only if statements and while statements without ifs and no changes.</p>
  <pre><code>This is the loop I am working on. 
     
  
  public boolean checkDirectorNameIsNotDuplicate(Director director) {
          int id = 1;
          String dFName;
          String dSName;
              while(directorDao.existsById(id)==true) {
                  dFName = directorDao.getDirectorFirstNameById(id);
                  dSName = directorDao.getDirectorSurnameById(id);
                  if (!director.getDirectorFirstName().equals(dFName) &amp;&amp; !director.getDirectorSurname().equals(dSName)){// if directorFirstName is not equal to dFName AND directorSurname is not equal to dsname
                          id++; //move to next Id
                          System.out.println(id);
                          }
                  else {
                              if (director.getDirectorFirstName().equals(dFName) &amp;&amp; director.getDirectorSurname().equals(dSName)) {
                                  return true;
                              }
                              else {
                                  id++;
                              }
                      }
                  }
              return false;
      }
  </code></pre>