Created
September 2, 2014 18:45
-
-
Save JohnFord/48c701741417476e2eca to your computer and use it in GitHub Desktop.
Unzip a list of List[List[Any]]?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.mutable.ListBuffer | |
val diffs: ListBuffer[List[Any]] = new ListBuffer[List[Any]]() | |
diffs.append(List("field1", 1, 2)) | |
diffs.append(List("field2", 3, 4)) | |
diffs.append(List("field3", 5, 6)) | |
/* At this point, I'd like to do something like: diffs.toList.unzip and wind up with List("field1", "field2", "field3"), List((1,2), (3,4), (5,6)) | |
But that thows an exception: "error: No implicit view available from List[Any] => (A1, A2)." */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment