title: How to update a value for a key in HashMap?
body: <p>I am having HashMap like this,</p>
  
  <pre><code>HashMap&lt;String,Set&lt;String&gt;&gt; map = new HashMap&lt;String,Set&lt;String&gt;&gt;();
  </code></pre>
  
  <p>I am trying to do before adding an element in <code>map</code>,</p>
  
  <ol>
  <li>Want to check whether the <code>key</code> exist or not, i can get it by using <code>map.containsKey()</code>.</li>
  <li>If the key exist, i want check the size of <code>Set</code> respective to that key.</li>
  <li>If <code>size &lt;= 1</code>  i want add an element in that set.</li>
  </ol>