title: How to remove a range of Binary Search Tree nodes that uses generic nodes
body: <p>I have a BST that uses Generics loaded in from a local file containing all the counties, their state and the population of those counties. my compareTo() is running off of the Population values. How can I create a method calling a min/max that removes all Nodes within that specified range? </p>
  
  <p>I currently have coded it as such:</p>
  
  <pre><code>public void removeRange(int min, int max) {
      removeRange(root, min, max);
  }
  
  private void removeRange(TreeNode&lt;T&gt; current, int min, int max) {
      if (current.value.compareTo(min) &lt; 0 || current.value.compareTo(max) &gt; 0) {
          if (current.left != null) {
              removeRange(current.left, min, max);
          }
          if (current.right != null) {
              removeRange(current.right, min, max);
          }
      } 
  
      else {
          if (current.left != null) {
              removeRange(current.left, min, max);
          }
          if (current.right != null) {
              removeRange(current.right, min, max);
          }
          remove(current.value);
      }
  }
  </code></pre>
  
  <p>I can't use compareTo()'s on Integers as to my current knowledge and I can't find a way to insert my range within my demo class as a Generic type to create my range.</p>