Null pointer exception in Map<Set<Node>,String>>
<p>I checked the values before finding.....all the values were assigned
    but I'm getting nullpointer exception....can any one tell me how to iterate through map if this is wrong?   </p>

<pre><code>static String findtheregion(Map&lt;Set&lt;Node&gt;, String&gt; rtn1,Node node) 
        {
            Set&lt;Set&lt;Node&gt;&gt; ls=rtn1.keySet();
            Iterator&lt;Set&lt;Node&gt;&gt; it=ls.iterator();
            String str;
            while(it.hasNext())
            {
                Set&lt;Node&gt; sn=it.next();
                if(sn.contains(node)){
                    str=rtn1.get(sn);
                return str;}
            }
            return null;
        }
</code></pre>
