title: How to set thread number for the parallel collections?
body: <p>I can run scala's foreach in parallel like that:</p>
  
  <pre><code>val N = 100
  (0 until N).par.foreach(i =&gt; {
     // do something
  })
  </code></pre>
  
  <p>But how can I set thread number? I want something like that:</p>
  
  <pre><code>val N = 100
  val NThreads = 5
  (0 until N).par.foreach(NThreads, i =&gt; {
     // do something
  })
  </code></pre>