title: Comparing generic types using Comparable and Comparator
body: <p>I've run into a headache I'm having difficulty debugging. I am trying to compare two generic values  so I can insertion sort them according to values into an array. This is my first time working with the Comparable and Comparator interfaces so any additional advice surrounding these issues would be great. </p>
  
  <p>This is how my class is set up:</p>
  
  <pre><code>public class SVStore&lt;K, V extends Comparable&lt;V&gt;&gt; implements Pairs&lt;K, V&gt;, Iterable&lt;K&gt;, Comparable&lt;V&gt;, Comparator&lt;V&gt; {
  </code></pre>
  
  <p>The put() method:</p>
  
  <pre><code>@Override
  public V put(K key, V value) {
  
      SVData&lt;K, V&gt; tab[] = table;
      for (int i = 0; i &lt; table.length - 1; i++) {
          if (value.compareTo(tab[i].dataValue) &lt;= 0) {
              int index = i;
              for( int j = index; j &lt; size - 1; j++){
                  tab[j + 1] = tab[j];
              }
          }
          tab[i].setDataKey(key);
          tab[i].setDataValue(value);
          size++;
      }
      return value;
  }
  </code></pre>
  
  <p>These are the compareTo() and compare methods I am trying to implement.</p>
  
  <pre><code>@Override
  public int compareTo(V t) {
   return compare(t, this);
   }
  
  @Override
  public int compare(V t, V t1) {
      if (t.equals(t1)){
          return 0;
      } else if (t &lt; t1){
          return -1;
      } else {
          return 1;
      }
  }
  </code></pre>
  
  <p>The first issue I am running into is in the compareTo() method and it is centering around "this". The error says "required: V,V
    found: V,SVStore". I know the answer is not to cast "this" to V. How do I compare it to the V in that array index?</p>
  
  <p>The second issue I am having is... } else if (t &lt; t1){ in the compareTo() method. The error is "bad operand types for binary operator '&lt;' first type:  V   second type: V". If it is recognizing both as V for both types why is it a bad operand?</p>
  
  <p>I think all the code needed is there. I try to keep these as concise as possible, but if there's any additional code someone needs, I'm happy to provide it. Cheers!</p>