title: Insertion Sort Access / Usability Issues
body: <pre><code>SortedArrayList&lt;E extends Comparable&lt;? super E&gt;&gt; extends ArrayList&lt;E&gt; {
  
  public SortedArrayList(){
  }
  
  public void insertionSort(E a){
  
      for (int i=1; i&lt;this.size(); i++ )
      {
          E value = this.get(i);
          int j;
  
          for (j = i; j &gt; 0; j--)
          {
              if (this.get(j - 1).compareTo(value)&lt;0) { 
                  break;
              }
              else {
                  this.set(j, this.get(j-1));
                  //a.set(j-1, a.get(j));
              }
          }
  
          this.set(j, value);
      }
  
  }
  </code></pre>
  <p>}</p>
  <p>I have the above custom insertion sort method.</p>
  <p>With the following Classes that need to be sorted, as so:</p>
  <pre><code>    public class User implements Comparable{
  
  private String firstname;
  
  private String surname;
  private int numberOfBooksHeld;
  
  @Override
  public int compareTo(Object o) {
      int LnComp = surname.compareTo(this.surname);
      if (LnComp != 0) {
          return LnComp;
      }
      else {
          int FnComp = firstname.compareTo(this.firstname);
          return FnComp;
      }
  }
  </code></pre>
  <p>and</p>
  <pre><code>public class Book implements Comparable {
  
      private String title;
  private String authorFirstName;
  private String authorSurname;
  private boolean loan;
  private User user;
  
  @Override
  public int compareTo(Object o) {
      int LnComp = authorSurname.compareTo(this.authorSurname);
      return LnComp;
  }
  </code></pre>
  <p>I am storying the sortedArrayList in a class called library</p>
  <pre><code>import java.util.ArrayList;
  
  public class Library {
  private final ArrayList&lt;Book&gt; totalBookInventory = new ArrayList&lt;&gt;();
  private ArrayList&lt;Book&gt; booksOnLoan = new ArrayList&lt;&gt;();
  private ArrayList&lt;Book&gt; booksInStock = new ArrayList&lt;&gt;();
  private ArrayList&lt;User&gt; userList = new ArrayList&lt;&gt;();
  ...}
  </code></pre>
  <p>The totalBookInventory is the sorted ArrayList where the sorted Books are supposed to be stored and UserList is where the sorted user list is supposed to be stored</p>
  <p>Im struggling with invoking it from my driver class</p>
  <p>i've tried to use:</p>
  <pre><code>import java.io.*;
  </code></pre>
  <p>import java.util.ArrayList;
  import java.util.Scanner;</p>
  <pre><code>public class Driver {
  private final Library l;
  private final User u;
  private final SortedArrayList s1;
  
  public Driver() {
      this.l = new Library();
      this.u = new User();
      this.s1 = new SortedArrayList();
  }
  </code></pre>
  <p>I am struggling adding / invoking new Users / Books into InsertionSort method from the driver class, which should then be added to the the totalBookInventory array and userlist.</p>
  <p>ive tried:</p>
  <pre><code>s1.insertionSort(new User(splitString[0], splitString[1], 0));
  </code></pre>
  <p>However, this obviously doesn't add to the userList.</p>
  <pre><code>bookList.insertionSort(new User(splitString[0], splitString[1], 0));
  </code></pre>
  <p>and also this code wont access the insertionSort class.</p>
  <p>really struggling with accessing and adding into the necessary ArrayList, do I need the ArrayLists to be fields of Driver or? Please help, thank you in Advance</p>