title: Initializing linked list
body: <p>When I run my driver class, my list wont initialize. This is what should be necessary to start the list.</p>
  
  <pre><code>public class SortedListReferenceBased implements ListInterface {
      private Node head;
      private int numItems; // number of items in list
  
      public SortedListReferenceBased()
      // creates an empty list
      {
          head = new Node(null);
          numItems = 0;
  
      } // end default constructor
  
      public boolean isEmpty()
      // Determines whether a list is empty
      {
          return true;
      } // end isEmpty
  
      public int size()
      // Returns the number of items that are in a list
      {
          return numItems;
      } // end size
  
      public void removeAll()
      // Removes all the items in the list
      {
          head = null;
          numItems = 0;
  
      } // end removeAll
  
      public Object get(int index) throws ListIndexOutOfBoundsException
      // Retrieves the item at position index of a sorted list, if 0 &lt;= index &lt;
      // size().
      // The list is left unchanged by this operation.
      // Throws an exception when index is out of range.
      {
          if (index &lt; 0 || index &gt;= numItems) {
              throw new ListIndexOutOfBoundsException(index + " is an invalid index");
          }
          return new Object();
      }
  
      public void add(Object item) throws ListException
      // Inserts item into its proper position in a sorted list
      // Throws an exception if the item connot be placed on the list
      {
          try {
              Node newNode = new Node(item);
              if (head != null) {
                  int i = locateIndexToAdd(item);
                  if (i &gt;= -1 &amp;&amp; i &lt;= numItems) {
                      add(i, item);
                  }
              } else {
                  head = new Node(newNode);
                  Node curr = head.getNext();
                  curr.setNext(null);
                  numItems++;
              }
          } catch (Exception e) {
              throw new ListException("Add to List failed:  " + e.toString());
          }
      }
  }
  </code></pre>