title: HashMap: printing specific entries
body: <p>I want to write a program that prints out entries "0" and "4" of the HashMap (i.e. entry.getKey(0) and entry.getKey(4) but it won't let me do this) What would be another way using what I already have? </p>
  
  <p>Basically I have this: </p>
  
  <pre><code>HashMap&lt;String, Integer&gt; hm = new HashMap&lt;String, Integer&gt;();
  </code></pre>
  
  <p>I can iterate over each entry using this code:</p>
  
  <pre><code>for (Map.Entry&lt;String,Integer&gt; entry : hm.entrySet())
  {
      System.out.println(entry.getKey() + "/" + entry.getValue());
  }
  </code></pre>
  
  <p>Since people have asked for more contextual information, I am storing a set of strings in the HashMap. For example the 0th entry is "Bob", the 1st entry is "Mindy", the 2nd is "Yasser", the 3rd is "Greg" and the 4th is "Jacky." I want the program to print out the 0th and 4th entries of the populated HashMap. </p>