title: Missing return statement in a for each loop
body: <p>I'm getting the error "Missing return statement" with this code:</p>
  
  <pre><code>public String getAuthorFullName(String title)
  {
      for (Book authorName : inventory)
          if (authorName.getTitle() != null)
          {
              return authorName.getAuthor().getName().getFullName();
          } 
          else
          {
              return null;
          }
  } 
  </code></pre>
  
  <p>I want to return o  returns the full name of the author who wrote the book by this title or return null if there is no Book with this title, or if title is null or "".</p>
  
  <p>I tried to put the code like this:</p>
  
  <pre><code>public String getAuthorFullName(String title)
  {
      for (Book authorName : inventory)
          if (authorName.getTitle() != null)
          {
              return authorName.getAuthor().getName().getFullName();
          }
          return null;
  </code></pre>
  
  <p>But it always returns the first Author in the list...</p>
  
  <p>Can somebody help me please? Thanks a lot.</p>