title: Converting Map[String, Seq[Int]] to Seq[Seq[Int]]
body: <p>I am trying to convert data that looks like this:</p>
  
  <pre><code>val inputData =
    Seq(("STUDY1", "Follow-up", 1),
      ("STUDY1", "Off Study", 2),
      ("STUDY1", "Screening", 3),
      ("STUDY1", "Treatment", 4),
      ("STUDY2", "Follow-up", 5),
      ("STUDY2", "Off Study", 6),
      ("STUDY2", "Screening", 7),
      ("STUDY2", "Treatment", 8));
  </code></pre>
  
  <p>into data that looks like this:</p>
  
  <pre><code>val desiredData =
    Seq(Seq(1,2,3,4),
      Seq(5,6,7,8));
  </code></pre>
  
  <p>The closest that I've gotten is with this:</p>
  
  <pre><code>val result: Map[String, Seq[Int]] =
    data.groupBy(i =&gt; i._1)
      .mapValues(j =&gt; j.map(k =&gt; k._3))
      .mapValues(_.toArray)
  
  result.values.toSeq
  </code></pre>
  
  <p>This yields:</p>
  
  <pre><code>res0: Seq[Seq[Int]] = Stream(WrappedArray(1, 2, 3, 4), ?)
  </code></pre>
  
  <p>That last question mark is throwing me for a loop.</p>
  
  <p><strong>EDIT</strong>
  Future internet travelers who land here: my code actually <em>did</em> work ... my confusion stemmed from understanding what the <code>?</code> was all about. Answers from folks down below helped me see that <code>mapValues</code> did lazy evaluation, and that the <code>?</code> simply implies that.</p>