Regarding calculating the total of keys
<p>Please don't consider this question as duplicate although I have a similar question earlier but this time it is different..</p>

<pre><code>Map &lt;String, String&gt;m = new LinkedHashMap&lt;String, String&gt;();
m.put ("123", "23"); 
m.put ("323", "23");
m.put ("153", "23");
m.put ("623", "23");
m.put ("125", "23");
m.put ("122", "24");
m.put ("167", "24");
m.put ("173", "24");
m.put ("113", "25");
</code></pre>

<p>I need to find out the count of keys associated with patient Id 23 here as shown above 5 keys are associated , I have followed the below approach</p>

<pre><code>List&lt;String&gt; keys = new ArrayList&lt;String&gt;();
        for(String str: m.keySet())
        {
            if(m.get(str).equals("23")) {
                keys.add(str);
                System.out.println(str);
            }
        }
</code></pre>

<p>Please advise is there any other approach also which is more efficient like making comprator or anything else .</p>
