Skip to content

Instantly share code, notes, and snippets.

@dacc
Created May 15, 2013 22:51
Show Gist options
  • Save dacc/5588059 to your computer and use it in GitHub Desktop.
Save dacc/5588059 to your computer and use it in GitHub Desktop.
scala> case class Foo(bars: Seq[Int])
defined class Foo
scala> val foos = Seq(
| Foo(bars=Seq(1, 2, 3)),
| Foo(bars=Seq(4, 5, 6))
| )
foos: Seq[Foo] = List(Foo(List(1, 2, 3)), Foo(List(4, 5, 6)))
scala> foos.map(_.bars).flatten
res1: Seq[Int] = List(1, 2, 3, 4, 5, 6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment