title: Cannot resolve method "compareTo(Friend)"
body: <p>I'm creating a FriendList which extends ArrayList and is populated with a Friend object.  However when I try accessing methods normally available to Friend, the compiler says it cannot resolve the method - in this case compareTo(Friend).</p>
  
  <p>FriendList class:</p>
  
  <pre><code>public class FriendList&lt;Friend&gt; extends ArrayList&lt;Friend&gt; {
  
      private boolean isAdded;
  
      public FriendList() {
          isAdded = false;
      }
  
      public void alphabetAdd(Friend friend) {
          if (this.isEmpty()) {
              add(friend);
              return;
          }
  
          int index = 0;
  
          // add friends alphabetically
          while (!isAdded) {
              Friend f = this.get(index+1);
              if (f.compareTo(friend) &lt; 0) {
                  index++;
              } else {
                  this.add(index, friend);
                  isAdded = true;
              }
          }
      }
  }
  </code></pre>
  
  <p>Friend class:</p>
  
  <pre><code>public class Friend implements Comparable&lt;Friend&gt; {
  
  // constructors and other methods work fine - just need to see compareTo
  
  //    @Override
      public int compareTo(@NonNull Friend o) {
  
          String name1 = getUserFirstName() + getUserLastName();
          Friend f;
  
          if (o instanceof Friend) {
              f = (Friend) o;
  
              String name2 = f.getUserFirstName() + f.getUserLastName();
  
              if (name1.compareTo(name2) &lt; 0)
                  return -1;
              else if (name1.compareTo(name2) &gt; 0)
                  return 1;
  
          }
  
          return 0;
      }
  }
  </code></pre>