title: Best way to remove an element from a List inside of a Map in Immutable.js
body: <p>I am using <a href="http://facebook.github.io/immutable-js/" rel="noreferrer">Facebook's Immutable.js</a> to speed up my React application to take advantage of the <a href="https://facebook.github.io/react/docs/pure-render-mixin.html" rel="noreferrer">PureRender mixin</a>. One of my data structures is a <code>Map()</code> and one of the keys in that map has a <code>List&lt;Map&gt;()</code> as its value. What I'm wondering is, not knowing the index of the item I want to remove from the <code>List()</code>, what is the best way to go about removing it? So far I have come up with the below. Is this the best (most efficient) way?</p>
  
  <pre><code>// this.graphs is a Map() which contains a List&lt;Map&gt;() under the key "metrics"
  onRemoveMetric: function(graphId, metricUUID) {
      var index = this.graphs.getIn([graphId, "metrics"]).findIndex(function(metric) {
          return metric.get("uuid") === metricUUID;
      });
      this.graphs = this.graphs.deleteIn([graphdId, "metrics", index]);
  }
  </code></pre>
  
  <p>(I have considered moving the <code>List&lt;Map&gt;()</code> to a <code>Map()</code> itself since each element in the list has a UUID, however, I'm not at that point yet.)</p>