title: Createing an Enumeration lookup. Multiple keys to an single object
body: <p>I've been using Joshua Bloch's excellent pattern to create look ups from strings (or other types) to enumeration objects. After creating the enumeration objects we need to create a map as:</p>
  
  <pre><code>private static final Map&lt;String, MyEnumType&gt; MY_MAP =
      Stream.of(values())
            .collect(toMap(MyEnumType::myFunction, e -&gt; e));
  </code></pre>
  
  <p>where <code>myFunction</code> return the string I want to map. We then create a static method that uses the Map to look up objects by key.</p>
  
  <p>This works well, but now I have a requirement to map each enumeration object from <em>multiple</em> strings. </p>
  
  <p>I've updated myFunction to return <code>List&lt;String&gt;</code>. Now I want my stream to iterate over the list, inserting <code>e</code> objects into the Map, but I can't quite work out how. </p>
  
  <p>I think the problem is that if I create a Stream I loose the <code>e</code> object to insert. </p>
  
  <p><strong>Update:</strong> There appears to be a bit of confusion about what I'm asking to do. I've got two working answers (so I'm happy) but I'll add an example which might help anybody who is looking to solve the same problem.</p>
  
  <p>Consider an enumeration of days of the week - the type should have exactly 7 objects in it. I'm trying to write a look up method from a text description. The TUESDAY object needs to be mapped from two different keys - <code>tuesday</code> and <code>tue</code>. The <code>myFunction</code> method will return both of these keys in a List</p>
  
  <p>For look up purposes I need my <code>Map&lt;String, Week&gt;</code> to have two keys pointing to the TUESDAY object.</p>