title: How do I correctly implement Comparable for List in this instance?
body: <p>What I want to do is use the compareTo() method to compare removedItemFromList1 and removedItemFromList2, then insert whichever value is smaller into the modifiedList3 and put the larger of the two removedFromList 1 or 2 back into its original list.  If I had hair long enough to pull, it would have been pulled out by now...Am I not casting correctly? How do I correctly go about using the compareTo() method to accomplish this?</p>
  
  <pre><code>public class List&lt;Integer&gt; implements Comparable 
  {
      private ListNode&lt;Integer&gt; firstNode;
      private ListNode&lt;Integer&gt; lastNode;
  
  
      public void insertAtBack (Integer insertItem)
      {
          if ( isEmpty())
              firstNode = lastNode = new ListNode&lt;Integer&gt;(insertItem);
          else 
              lastNode = lastNode.nextBasket = new ListNode&lt;Integer&gt;( insertItem );
      }
  
      public Integer removeFromBack() 
      {   
          Integer removedItem = (Integer) lastNode.topBucketInBasket;
  
          if ( firstNode == lastNode)
              firstNode = lastNode = null;
          else
          {
              ListNode&lt;Integer&gt; current = firstNode;
  
              while ( current.nextBasket != lastNode)
                  current = current.nextBasket;
  
              lastNode = current;
              current.nextBasket = null;
          }
  
          return removedItem;
      }
  
      public boolean isEmpty()
      {
          return firstNode == null;
      }
  
      public List&lt;Integer&gt; merge(List&lt;Integer&gt; list1, List&lt;Integer&gt; list2)
      {
          List&lt;Integer&gt; modifiedList3 = new List&lt;Integer&gt;();
  
           Integer removedItemFromList1 = (Integer) list1.removeFromBack();
           Integer removedItemFromList2 = (Integer) list2.removeFromBack();
  
            ((Comparable) removedItemFromList1).compareTo( removedItemFromList2);
  
           int comparison = compareTo(removedItemFromList2);
  
           if ( comparison == 1)
              modifiedList3.insertAtBack(removedItemFromList2); 
              list1.insertAtBack(removedItemFromList1);
  
           if ( comparison == -1)
               modifiedList3.insertAtBack(removedItemFromList1);
              list2.insertAtBack(removedItemFromList2);
  
          return modifiedList3;   
      }
      @Override
      public int compareTo(Integer itemToCompare)
      {
          final int BEFORE = -1;
          final int AFTER = 1;
          if (this.removedItemFromList1 &lt; list2.removedItemFromList2) return BEFORE;
          if (this.removedItemFromList1 &gt; list2.removedItemFromList2) return AFTER;
      }
  
  }
  </code></pre>