title: Add Linked List to the End of Another Linked List in Java
body: <p>This is using the <a href="https://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html" rel="nofollow">Java Linked List</a>. I have 2 linked lists. I would like to add them together by linking the last node in the 0th list to the 0th node in the 1st list. Currently I can append them together by iterating through the second list and adding every element in it like so:</p>
  
  <pre><code>LinkedList&lt;HashSet&lt;Integer&gt;&gt; ll = someList;//Some random list
  LinkedList&lt;HashSet&lt;Integer&gt;&gt; subSetLl = getSubsets(inSetSub);//Also some list
  
  for (HashSet&lt;Integer&gt; set : subSetLl){
      ll.add(set);
  }
  </code></pre>
  
  <p>However, since these are Linked Lists, there should be a more efficient way to add them together, by pointing the end of one to the beginning of the next. Does such a thing exist?</p>
  
  <p>EDIT FOR CLARITY: The current method runs in O(n) where n is the length of the 1st Linked List. Is there a O(1) method to accomplish this if both elements are Linked Lists?</p>