title: Least common upper class of DecisionTreeRegressor and RandomForestRegressor
body: <p>I want to create a method that will return one of these two types:</p>
  
  <pre><code> - org.apache.spark.ml.regression.DecisionTreeRegressor
   - org.apache.spark.ml.regression.RandomForestRegressor
  </code></pre>
  
  <p>What will be the return type of this method?  I believe that it will have a return type of</p>
  
  <pre><code> - org.apache.spark.ml.Estimator&lt;M&gt;
  </code></pre>
  
  <p>but I don't know what the type parameter <code>M</code> should be.</p>
  
  <p>If I simply do this (for example):</p>
  
  <pre><code>  def getRegressor(): org.apache.spark.ml.Estimator = {
      new DecisionTreeRegressor()
        .setLabelCol("label")
        .setFeaturesCol("features")
        .setMaxBins(100)
    }
  </code></pre>
  
  <p>I get the following error:</p>
  
  <blockquote>
    <p>class Estimator takes type parameters</p>
  </blockquote>