title: Get Value of HashMap using part of the key
body: <p>I have an HashMap(String,Object). The key is combination of more than 1 unique ID. I have an input, a string which is part of the key(1 unique ID). I need to take the value in HashMap using that part of the key i have without iterating thousands of values in HashMap.</p>
  
  <p>Can we achieve it using any Regex statement in HashMap.get()?</p>
  
  <p>My Key is xxx.yyy.zzz where combination of xxx.zzz is unique throughout the Map. I have xxx and zzz as input. Also i have set of possible values of yyy(5-6 possibilities which may increase as well)for a given zzz.</p>
  
  <p>I have two options to solve this now.</p>
  
  <ol>
  <li>Map.Entry to check whether key starts and ends with xxx and zzz respectively</li>
  <li>Trial and Error Method
   i. Form key xxx.yyy.zzz with all possible yyys and check for whether the key is present or not using .contains()
   ii. But this way, if i do .contains() 5-6 times for each call, won't it loop through 5-6 times at the worst case?
   iii. Also i am creating more strings in stringpool.</li>
  </ol>
  
  <p>Which one should i prefer? </p>