title: How to remove a Key from a HashMap using the Value
body: <p>I have an assignment that requires me to has a Map that is configured...</p>
  
  <pre><code>Map&lt;Integer,Event&gt; eventList = new HashMap&lt;&gt;();
  </code></pre>
  
  <p>And I have to write a method that has the following header...</p>
  
  <pre><code>public String removeEvent(Event eventObj)
  </code></pre>
  
  <p>The idea is to pass it an Event object, check if the event already exist as a value in the Map, and if it does, remove it and return a String message as confirmation that it has been removed. </p>
  
  <p>The issue I have is that it stipulates that I cannot iterate over the map for the solution. </p>
  
  <p>I can use the containsValue() method, or my overidden equals() method, to check if the object already exists in the map, but I now have the issue where I am not sure how I can remove the key pair value that matches? </p>
  
  <p>Any assistance would be good as I am quite new to Maps and often struggle moving between Key and Value.</p>