How to filter "Null" values from HashMap<String, String>?
<p>Following map, having both key-value pair as String, Write a logic to filter all the null values from Map without using any external API's ?</p>

<p>Is there any other approach than traversing through whole map and filtering out the values (Traversing whole map and getting Entry Object and discarding those pair) ?</p>

<pre><code>        Map&lt;String,String&gt; map = new HashMap&lt;String,String&gt;();

        map.put("1", "One");
        map.put("2", "Two");
        map.put("3", null);
        map.put("4", "Four");
        map.put("5", null);
        //Logic to filer values
        //Post filtering It should print only ( 1,2 &amp; 4 pair )  
</code></pre>