title: How to further extract list to make a triple nested list from a double nested list
body: <p>I have a list of lists that I want to separate using one of the internal values</p>
  
  <p>I was thinking hash map would work but I am not that familiar with it so a list would look like this</p>
  
  <pre><code>val data: List[(Int, Int, Int, Int)] = List((0, 1, 2, 3), (1, 1, 2, 7), (2, 1, 5, 5), (3, 1, 3, 7), (4, 1, 2, 8), (5, 1, 5, 4), (6, 1, 3, 5))
  </code></pre>
  
  <p>and I want to get something like:</p>
  
  <pre><code>List(((0, 1, 2, 3), (1, 1, 2, 7), (4, 1, 2, 8)), ((3, 1, 3, 7),(6, 1, 3, 5)),((5, 1, 5, 4), (2, 1, 5, 5)))
  </code></pre>
  
  <p>I separate it by the 3rd element in each list</p>