title: Retrieving String Values through Integer values
body: <p>I have an Integer ArrayList with elements e.g. 60,45,60,15 - These are activity minutes. Each of these elements have an associated Activity Names. E.g. Activity A has time of 60, Activity B has time of 45, etc.</p>
  
  <p>How to write a function in Java which given integer value, can return Activity Name? Initially I thought HashMap was correct, but since minutes can be duplicate, it overwrites the previous value if its same and I am not interested in implementing a custom Map similar to MultiValueMap of Guava collections.</p>
  
  <p>Any clues to implement this helps.</p>
  
  <p><strong>EDIT 1:</strong></p>
  
  <p>I tried implementing as suggested by Wasi - however, I am getting IndexOutOfBoundsException. I am expecting both activities from mapping60, 1 activity from mapping15, and 1 activity from mapping45. What am I doing wrong?</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  
  public class MultiMapTest {
  
  public static void main(String[] args) {
  
      Map&lt;Integer, List&lt;String&gt;&gt; map = new HashMap&lt;Integer, List&lt;String&gt;&gt;();
  
      List&lt;String&gt; activityMappings60 = new ArrayList&lt;String&gt;();
      activityMappings60.add("Act 1 60min");
      activityMappings60.add("Act 2 60min");
  
      List&lt;String&gt; activityMappings15 = new ArrayList&lt;String&gt;();
      activityMappings15.add("Act 3 sprint");
      activityMappings15.add("Act 4 sprint");
  
      List&lt;String&gt; activityMappings45 = new ArrayList&lt;String&gt;();
      activityMappings45.add("Act 5 45min");
      activityMappings45.add("Act 6 45min");
  
  
      map.put(new Integer(60), activityMappings60 );
      map.put(new Integer(15), activityMappings15 );
      map.put(new Integer(45), activityMappings45 );
  
      List&lt;Integer&gt; arrayInteger = Arrays.asList(60,60,15,45);
  
      for(Integer i=0; i &lt; arrayInteger.size();i++) {
          System.out.println(map.get(arrayInteger.get(i)).get(i));
          System.out.println(map.get(arrayInteger.get(i)).remove(i));
      }
  
  }
  </code></pre>