title: generic getter method
body: <p>I need help figuring out how to implement a generic getter method.  Here's the code I have so far:</p>
  
  <pre><code>public class Pair&lt;X extends Comparable&lt;X&gt;, Y extends Comparable&lt;Y&gt;&gt;
      implements Comparable&lt;Pair&lt;X, Y&gt;&gt;{
  
      private final X first;
      private final Y second;
  
      public GENERIC getX() {
          return X;
      }
  
      public GENERIC getY() {
          return Y;
      }
  </code></pre>
  
  <p>Could someone explain to me how to replace the GENERICs with some sort of <code>&lt;A extends classA&gt; A</code> object return type for this class?  I've seen examples of other methods with generic return values but I'm failing to understand how to apply it here.  Thanks!</p>