title: How can I create a search method to search for name which completely matches all the other entry names
body: <p>Don't know if the question I was asking made clear to you. So I am trying to make a method which lets me search name in my telephone directory class and finds all the entries with the same name. </p>
  
  <p>//this is my method in the telephone directory class</p>
  
  <pre><code>public String searchEntry(Entry e) {
      if (entrylist.contains(e)) {
          return e.getSurname();
      }
  
      return null;
  
  }
  </code></pre>
  
  <p>however what this method dopes is lets search for an entry and find's its extension number. </p>
  
  <p>in my entry class I have got three parameters passing in the constructor</p>
  
  <pre><code>public Entry(String surname, String initials, String extension) {
      this.setSurname(surname);
      this.setInitials(initials);
      this.setExtension(extension);
  }
  
      ListDirectory ls = new ListDirectory();
      Entry e = new Entry("james", "K", "9023");
      ls.addEntry(e);
      System.out.println(ls.searchEntry(e));;
  
  //this prints out james
  </code></pre>
  
  <p>I am not sure how I could look up the names which are saved my in my telephone directory class. </p>