title: Need help adding one linked list to another linked list
body: <p>I am trying to add one LinkedList to another LinkedList. I have been trying to do this for the past hour or two and I am at my wits end. Here is the line I am trying to run in main.</p>
  
  <pre><code>l.addList(l2); //l is the original list and l2 is the list I am trying to add, l2 does have elements in it.
  </code></pre>
  
  <p>Here's the LinkedList class: </p>
  
  <pre><code>public class LinkedList&lt;T&gt;
  {
  
  private Node&lt;T&gt; head;   // head of the list always at the front
  private Node&lt;T&gt; cursor; // cursor that moves along the one way list
  
  // constructor
  public LinkedList ()
  {
      // the first node is not used, dummy node
      // so we're always dealing with the element to the right of
      // the cursor not what the cursor is pointing to.
      head = new Node&lt;T&gt;(null, null);
      cursor = head;
  }
  
  // if the cursor's next is null, then we're at the end
  public boolean isAtEnd()
  {
  
  return(cursor.getNext() == null);
  
  }
  
  // move the cursor to the beginning of the list
  public void reset()
  {
  
  cursor = head;
  
  }
  
  // advance the cursor one spot to the right
  public void advance()
  {
  
  cursor = cursor.getNext();
  
  }
  
  // return the node to the right of the cursor
  public Node&lt;T&gt; getCurrent()
  {
  
  return cursor.getNext();
  
  }
  
  // return the first node in the list
  public Node&lt;T&gt; getFirst()
  {
  
  return head.getNext();
  
  }
  
  public void addList(LinkedList&lt;T&gt; list)
  {
      Node current = head;
  
      while (current.getNext() != null)
      {
          current = current.getNext();
      }
      current.setNext(list);
                      ^error here
  }
  
  // insert at the beginning of the list, this insert is done to the
  // right of the dummy node, but to the left of the first meaningful
  // node.
  public void listHeadInsert(T value)
  {
  
  head.setNext(new Node&lt;T&gt;(value, head.getNext()));
  
  }
  
  // wherever the cursor is, insert to the right of it, and move the
  // cursor to point to the newly inserted node
  // you may remove the line that advances the cursor, but you need
  // to make sure that you advance the cursor when inserting elements
  // at the end of the list one after another.
  public void listInsert(T value)
  {
  // insert to the right of the cursor
  cursor.setNext(new Node&lt;T&gt;(value, cursor.getNext()));
  
  cursor = cursor.getNext();
  
  }
  
  
  // move the cursor to the head of the list, and keep moving it
  // looking for the value, stop if you either find the value
  // or you have reached the end of the list without finding it.
  // return the node that contains the given value back to me.
  // this return will return null if the value is not found.
  public Node&lt;T&gt; listSearch(T value)
  {
  cursor = head;
  while(cursor.getNext() != null &amp;&amp;
        !cursor.getNext().getValue().equals(value))
      cursor = cursor.getNext();
  
  return cursor.getNext();
  
  }
  
  
  // first search (first 4 lines of the code)
  // if you find it (not null) then just remove it by making the
  // cursor's next pointer point to the node next to it's next
  // pointer (skip a node)
  public void listRemove(T value)
  {
  cursor = head;
  while(cursor.getNext() != null &amp;&amp;
        !cursor.getNext().getValue().equals(value))
      cursor = cursor.getNext();
  
  if(cursor.getNext() != null)
      {
      cursor.setNext(cursor.getNext().getNext());
  
      }
  
  }
  
  // don't search, just remove the node to the right of the cursor
  // if it's not null.
  public void listRemoveCurrent()
  {
  
  if(cursor.getNext() != null)
      {
      cursor.setNext(cursor.getNext().getNext());
  
      }
  
  }
  
  
  }
  </code></pre>
  
  <p>And here's the Node class:</p>
  
  <pre><code>// Node of any Reference type T
  
  public class Node&lt;T&gt;
  {
  
  private T value;        // this is the data value
  private Node&lt;T&gt; next;   // this is pointing to the next node
  
  
  // the node constructor
  public Node (T v, Node&lt;T&gt; n)
  {
      value = v;
      next = n;
  }
  
  // getters and setters for the node's value and next pointer
  public T getValue() {return value;}
  public Node&lt;T&gt; getNext() {return next;}
  public void setValue(T v){value = v;}
  public void setNext(Node&lt;T&gt; n){next = n;}
  
  }
  </code></pre>
  
  <p>I get the error: Incompatible types, LinkedList cannot be converted into Node in class LinkedList, line 69. I understand the theory when using headers and cursors I am just having issues putting it into practice.</p>