title: Search with wildcard in a Collection of String
body: <p>I have a <code>HashMap&lt;Integer,String&gt;</code>. I tried the following code to query the Map and return all possible values</p>
  
  <pre><code>public Collection&lt;String&gt; query(String queryStr) {
          List&lt;String&gt; list = new ArrayList&lt;String&gt;();
      for (Map.Entry&lt;String, Integer&gt; entry : myMap.entrySet()) {
          if (queryStr.matches(entry.getKey()))
              list.add(entry.getKey());
      }
      if (list.isEmpty())
          return null;
      else
          return list;
  }
  </code></pre>
  
  <p>If map has <code>"test","best","crest","zest","testy","tether","temper","teat","tempest"</code>.  A query of <code>te*t</code> should return <code>"teat","tempest","test"</code>. For 'test*' it should return "test", "testy". How to implement it? Is there any wildcard search for string? And I can't use any external libraries.</p>