title: How to fetch first 10 key value pairs in HashMap
body: <p>I am trying to iterate only the first "n" values in my Map, is there any method available or i need to control it only with a count variable. </p>
  
  <p>Below is an example, i have sorted a group of names belong to the same city. Now i only want the first 10 city and the person names in it. </p>
  
  <pre><code>for (Map.Entry&lt;String, List&lt;String&gt;&gt; entry : map.entrySet()) {
      List&lt;String&gt; list = entry.getValue();
      // Display list of people in City
  }
  </code></pre>
  
  <p>Is there a Map implementation that can hold fixed number of key,value pairs?
  Please get some directions. </p>
  
  <p>Thanks,</p>
  
  <p>-Vijay Selvaraj</p>