title: java combine two linkedlist
body: <p>I have a question for combining two linkedlist. Basically, I want to append one linkedlist to the other linkedlist.</p>
  
  <p>Here is my solution. Is there a more efficient way to do it without looping the first linkedlist?  Any suggestion would be appreciated.</p>
  
  <pre><code>    static Node connect(LinkedList list1, LinkedList list2) {
      Node original = list1.first;
      Node previous = null;
      Node current = list1.first;
      while (current != null) {
          previous = current;
          current = current.next;
      }
      previous.next = list2.first;
      return original;
  }
  </code></pre>