title: Java Method using generic parameter?
body: <p>I am new to Java and writing a method for a generic Linked List that accepts another Linked List as a parameter. As I understand, this new Linked List should be of the same type as the Linked List calling the method.</p>
  
  <p>So, instead of </p>
  
  <pre><code>public void insertList(MyLinkedList&lt;AnyType&gt; otherList, int idx) {
  </code></pre>
  
  <p>I should be specifying the type of otherList to match the list that calls insertList()? </p>
  
  <pre><code>list.insertList(MyLinkedList&lt;???&gt;, 0);
  </code></pre>
  
  <p>How would I do this if I don't know the type of list, since it's generic, but know that otherList needs to be the same type? I hope that makes sense. As I mentioned, I am new to Java, so if I am misunderstanding generics, please correct me. Thank you.</p>