title: How to convert a String to a generic type <E>?
body: <p>I have a binary tree <code>BinaryTree&lt;E&gt;</code> with the following variables</p>
  
  <pre><code>protected E data;
  protected BinaryTree&lt;E&gt; left,right;
  </code></pre>
  
  <p>given to me by the professor and was asked to double the value of each node which I did successfully with the following code (only relevant code shown here):</p>
  
  <pre><code>if (data != null) {
    this.setData(String.valueOf(Integer.parseInt(getData().toString()) * 2));
  }
  </code></pre>
  
  <p>Unfortunately this raises the following warning which I'd like to get rid of:</p>
  
  <pre><code>1 error found:
  Error: incompatible types: java.lang.String cannot be converted to E
  </code></pre>
  
  <p>Any ideas?</p>