title: Adding person to ArrayList unless they are already within the list (firstName and surname strings)
body: <p>I need to add Person p to the contacts ArrayList unless it contains the same surname and first name. </p>
  
  <p>In that case I need to return an error message "could not add person". Here is my current code:</p>
  
  <pre><code>public class AddressBook {
   private ArrayList&lt;Person&gt; contacts;
     public AddressBook(){
      this.contacts = new ArrayList&lt;Person&gt;();
   }    
  
    public void addPerson(Person p) {
     for (int i = 0; i &lt; contacts.size(); i++) {
      if(contacts.get(i).getfirstName().equals(p.firstName)){
          System.out.printf("could not add person");
      }
     }
     this.contacts.add(p);
    }            
  </code></pre>
  
  <p>I am having trouble figuring out how I should compare the strings about to be added via the <code>addPerson()</code> method with the existing strings contained within the Person object already contained within the list. </p>