title: Kotlin mutableMap foreach
body: <p>My question is more to understand the documentation. It say's:</p>
  <pre><code>fun &lt;K, V&gt; Map&lt;out K, V&gt;.forEach(
  action: (Entry&lt;K, V&gt;) -&gt; Unit)
  </code></pre>
  <p>However I don't understand how to implement it. How I get the Key and Value inside the loop?</p>
  <p>I want to sum for each item in <code>listItems</code> the value of the price. The map associates a string with an item</p>
  <pre><code>data class Item(val name: String, val description: String, val price: String, val index: Int)
  </code></pre>
  <p>Imagine <code>listItems</code> contains this:</p>
  <blockquote>
  <p>listItems[&quot;shirt&quot;]-&gt; name: shirt, description: lorem ipsum, price: 10, index: 0</p>
  <p>listItems[&quot;shoes&quot;]-&gt; name: shoes, description: lorem ipsum, price: 30, index: 0</p>
  </blockquote>
  <p>So the code would be something like:</p>
  <pre><code>var total: Int = 0
  listItems.forEach {
         total += parseInt(value.price)
      }
  </code></pre>
  <p>However I don't understand how to acces this <code>value</code> refering to the <code>V</code> of the documentation</p>