title: inserting in a sorted linked list in Java
body: <p>I need to insert some objects contained in a Node class into a LinkedList class in a sorted over. The Node class looks like:</p>
  
  <pre><code>public class Node {
      private Card val;
      private Node next;
      public Node(Card v) {
          val = v;
          next = null;
  }
  </code></pre>
  
  <p>where card implements the Comparator interface. I'm trying to write a function to insert these cards in sorted order (low to high) by card value in a LinkedList class (not the java.util.LinkedList class but a linked-list class I'm writing). Does anybody know how I could do this? Also it can't be a doubly-linked list.</p>