title: Overriding "equals" method: how to figure out the type of the parameter?
body: <p>I'm trying to override <code>equals</code> method for a parameterized class.</p>
  
  <pre><code>@Override
  public boolean equals(Object obj) {
      if (this == obj)
          return true;
      if (obj == null)
          return false;
      if (!(obj instanceof Tuple))
          return false;
  
      Tuple&lt;E&gt; other = (Tuple&lt;E&gt;) obj; //unchecked cast
      if (!a0.equals(other.a0) &amp;&amp; !a0.equals(other.a1)) {
          return false;
      }
      if (!a1.equals(other.a1) &amp;&amp; !a1.equals(other.a0)) {
          return false;
      }
  
      return true;
  }
  </code></pre>
  
  <p>How can I make sure that <code>&lt;E&gt;</code> of the <code>other</code> object is the same as <code>this</code>?</p>