title: Generic template ADT for dummies
body: <p>I need to write a sorted set over an binary search tree, the problem is, I don't know  how I can use abstract type and compare for those 2 objects in the context, because i need to have  my own comparator declared.</p>
  
  <p>I got so far but somehow i get stuck, since Compararable type i think is out of the question because of my own comparator method.</p>
  
  <p>static node class:</p>
  
  <pre><code>static class  BinaryNode&lt;ElementType&gt; {
      ElementType element;
      BinaryNode &lt;ElementType&gt; right;
      BinaryNode &lt;ElementType&gt; left;
  
      public BinaryNode(ElementType elm) {
          ElementType element = elm;
          right=left=null;
      }
  }
  </code></pre>
  
  <p>method example where I get confused:</p>
  
  <pre><code>   private BinaryNode find( ElementType x, BinaryNode t ) {
          while( t != null ) {
              if( x.compareTo( t.element ) &lt; 0 )
                  t = t.left;
              else if( x.compareTo( t.element ) &gt; 0 ) // is done with overrite of the comparable method, any Ideas please?
                  t = t.right;
              else
                  return t;    // Match
          }
  
          return null;         // Not found
      }
  </code></pre>