title: Scala TraversableOnce and toSet
body: <p>In <strong>Scala</strong>, why does the following occur when using the <code>toSet</code> functionality from <code>TraversableOnce</code>?</p>
  
  <p>If you create a worksheet (in IntelliJ) with the following code you will get the following output (NB: using Scala 2.10.2):</p>
  
  <pre class="lang-scala prettyprint-override"><code>val maps = List(List(1,2),List(3,4),List(5,6,7),List(8),List())
  
  maps.flatMap( _.map( _ +  " " ) )
  maps.flatMap( _.map( _ +  " " ) ).toSet
  maps.flatMap( _.map( _ +  " " ) ).toSet()
  </code></pre>
  
  <p>i.e. res4 produces a boolean</p>
  
  <pre class="lang-scala prettyprint-override"><code>&gt; maps: List[List[Int]] = List(List(1, 2), List(3, 4), List(5, 6, 7), List(8), List())
  &gt; res2: List[String] = List("1 ", "2 ", "3 ", "4 ", "5 ", "6 ", "7 ", "8 ")
  &gt; res3: scala.collection.immutable.Set[String] = Set("3 ", "8 ", "4 ", "5 ", "1 ", "6 ", "2 ", "7 ")
  &gt; res4: Boolean = false
  </code></pre>
  
  <p>Needless to say I was a confused for long enough until I noted <code>toSet</code> doesn't use parentheses in the implementation, but why the boolean?</p>