title: Java HashMap as method parameter - not specifying the "value" type
body: <p>This is a question about Java syntax. I am not stuck.</p>
  
  <p>For lists, let's say I have a List of Strings.</p>
  
  <pre><code>List&lt;String&gt; mylist;
  </code></pre>
  
  <p>As long as I don't need to access the elements in my list, I can refer to this list as a <code>List</code> (versus <code>List&lt;String&gt;</code>).<br>
  So I can have a method looking like that:</p>
  
  <pre><code>public int listSize(List list) {
      return list.size();
  }
  </code></pre>
  
  <p>Now let's assume I have a <code>HashMap</code>.</p>
  
  <pre><code>HashMap&lt;String, String&gt; myhash;
  </code></pre>
  
  <p>And a method accessing the <em>key</em> but never the <em>value</em>:</p>
  
  <pre><code>public boolean hashContainsKey(HashMap&lt;String, String&gt; hash, String key) {
      return hash.containsKey(key);
  }
  </code></pre>
  
  <p>Is there a nice way to only specify the "key" part of the HashMap?<br>
  Something like <code>HashMap&lt;String&gt;</code>?</p>