title: How do I create a mutable List backed by Map
body: <p>
  How can I return a <code>List&lt;E&gt;</code> backed by <code>Map&lt;K, E&gt;</code> if I have a method for mapping <code>Map</code> values to keys <code>valueToKeyMapper</code>?</p>
  
  <pre class="lang-java prettyprint-override"><code>class Foo {
     private Map&lt;Integer, String&gt; backedMap = new HashMap&lt;Integer, String&gt;();
  
     public List&lt;String&gt; getList() {
        // NEED TO RETURN LIST BACKED BY MAP
     }
  
     public String getById(Integer id) {
        return backedMap.get(id);
     }
  
     private static Integer valueToKeyMapper(String value) {
        // just as exampl. In reality value will be POJO with method like getId()
        return value.hashCode();
     }
  }
  </code></pre>
  
  <p>The code should work like this (simple example):</p>
  
  <pre class="lang-java prettyprint-override"><code>Foo foo = new Foo();
  foo.getList().add("something");
  String value = foo.getById("something".hashCode());
  // I should see something
  </code></pre>
  
  <p>Notes:</p>
  
  <ul>
  <li><code>List</code> should be mutable and changes must be propagated in underlying <code>Map</code></li>
  <li>I can't modify public methods of object <code>Foo</code>, because it's used in other projects</li>
  <li>I don't care about order in <code>List</code></li>
  <li>The <code>getById</code> method should continue to work fast</li>
  </ul>