Why do the type parameters have to be repeated twice?
<p>In this static function in Java, why must <code>&lt;K, V&gt;</code> be repeated in line 1?</p>

<pre><code>public static &lt;K, V&gt; HashMap&lt;K, V&gt; newInstance() {
  return new HashMap&lt;K, V&gt;();
} 
</code></pre>

<p>I understand why <code>HashMap&lt;K, V&gt;</code> is necessary since the function returns a HashMap with generic types K and V as keys and values respectively. However, why is the first <code>&lt;K, V&gt;</code> necessary in the function signature?</p>
