title: what does val dict = scala.collection.mutable.Map[Int, Int]().withDefaultValue(0) mean in scala?
body: <p>could anyone explain what below if statement does</p>
  <pre><code>if (dict.contains(sum-k)) count+= dict(sum-k)
              dict(sum) += 1
  </code></pre>
  <p>Actual code:</p>
  <pre><code>object Solution {
      def subarraySum(nums: Array[Int], k: Int): Int = {
          if (nums isEmpty) return 0
      
      val dict = scala.collection.mutable.Map[Int, Int]().withDefaultValue(0)
      var count = 0
      
      nums.scanLeft(0)(_+_).foreach { sum =&gt; 
          **if (dict.contains(sum-k)) count+= dict(sum-k)
          dict(sum) += 1**
      }
      
      count
  }
  </code></pre>
  <p>}</p>