Solved: Java: Cannot instantiate the type Foo
<p>I'm trying to create my own version of <code>HashMap</code> with some utility methods.  </p>

<p><strong>Foo.java</strong>:</p>

<pre><code>import java.util.HashMap;

public class Foo&lt;String, Parameter&gt; extends HashMap&lt;String, Parameter&gt; {

    public Foo() {
      super();
    }

    public Parameter Add(String key, MyType type) {
        return put(key, new Parameter(type)); // -&gt; This line causes compilation error
    }
  }
</code></pre>

<p>The following line:</p>

<pre><code>new Parameter(type);
</code></pre>

<p>produces <code>Cannot instantiate the type Foo</code>. </p>

<p>I checked <strong><code>Parameter</code> class and it is not an abstract class/interface</strong>, why am I getting this error?</p>

<p><strong>EDIT</strong><br>
Changing class declaration as following solved the problem:</p>

<pre><code>public class Foo extends HashMap&lt;String, Parameter&gt; {
</code></pre>
