Skip to content

Instantly share code, notes, and snippets.

@travisdachi
Last active August 13, 2016 15:01
Show Gist options
  • Save travisdachi/aa0b78c2250ca56bec9de005dff762c1 to your computer and use it in GitHub Desktop.
Save travisdachi/aa0b78c2250ca56bec9de005dff762c1 to your computer and use it in GitHub Desktop.
val g: Map<String, List<Present>> = list.groupBy { it.kid }
/*
{
Ralph=[Present(id=p0, toy=Dinosaur Figure, kid=Ralph, given=true)],
Ginger=[Present(id=p1, toy=Teddy Bear, kid=Ginger, given=false)],
Cherry=[Present(id=p2, toy=Teddy Bear, kid=Cherry, given=false), Present(id=p3, toy=Pony Plush, kid=Cherry, given=false)]
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment