title: Create a compareTo to a Generic Class that Implements Comparable
body: <p>I have a Generic Class with two type variables, which implements java.lang.Comparable.</p>
  
  <pre>
  public class DoubleKey&lt;K,J&gt; implements Comparable&lt;DoubleKey&lt;K,J&gt;&gt;{
  
      private K key1;
      private J key2;
  
      public DoubleKey(K key1, J key2){
          this.key1 = key1;
          this.key2 = key2;
      } 
  
      public K getFirstKey(){
          return this.key1;
      }
  
      public J getSecondKey(){
          return this.key2;
      }
  
      // need for Comparable interface
      public int compareTo(DoubleKey&lt;K,J&gt; aThat){
          ...
      }
  
  }
  </pre>
  
  <p>Becuase i implemeted it with Comparable, I need to write the compareTo() method. Because K, J can be of <strong>ANY</strong> type, I'm having problems on how to compare them completely. Is there a way to be able to catch all possible types (Primitive, Wrapper, Object) in the comparison? Thanks for the help!</p>