title: How to print all values of specific Hashmap key
body: <p><strong><em>Current Problem</strong>: I've build a HashMap to save and retrieve some key and values. but i'm not sure how to retrieve all values by a specific name (String). At the moment it's printing all the values from the Hashmap and that's not the thing that i want to achieve.</em></p>
  
  <p><em>In the example below i'm using the following fields</em>   </p>
  
  <p><strong>Fields</strong></p>
  
  <pre><code>String name
  // Object Example
  </code></pre>
  
  <p><strong>The HashMap</strong></p>
  
  <pre><code>Map&lt;String,Example&gt; mapOfExampleObjects = new HashMap&lt;String,Example&gt;();
  </code></pre>
  
  <p><strong>The for loop to retrieve the values from the hashmap by a certain key name</strong></p>
  
  <pre><code>for(Map.Entry&lt;String,Example&gt; entry: mapOfExampleObjects.entrySet()){
                      if(mapOfExampleObjects.containsKey(name))
                      {
                      System.out.println(entry.getKey() + " " + entry.getValue());
                      }
                  }
  </code></pre>
  
  <p><strong>Current output</strong></p>
  
  <pre><code>John + (Exampleobject)
  Ian + (Exampleobject)
  Ian + (Exampleobject)
  Jalisha + (Exampleobject)
  </code></pre>
  
  <p><strong>The Output that i want to achieve</strong></p>
  
  <pre><code>Ian + (Exampleobject)
  Ian + (Exampleobject)
  </code></pre>