How do you search through a map?
<p>I have a map:</p>

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

<p>and I would like to know how to search through it and find anything matching a particular string.  And if it is a match store it into an arraylist.  The map contains strings like this:</p>

<p>1,2,3,4,5,5,5</p>

<p>and the matching string would be 5.</p>

<p>So for I have this:</p>

<pre><code>  String match = "5";
  ArrayList&lt;String&gt; result = new ArrayList&lt;String&gt;();

 Enumeration num= ht.keys();
     while (num.hasMoreElements()) {
        String number = (String) num.nextElement();

        if(number.equals(match))
        {
           result.add(number);
        }

     }
</code></pre>
