Created
July 31, 2015 10:28
-
-
Save daveshah/798eabdfe42dc2c268e7 to your computer and use it in GitHub Desktop.
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
case class Person(id: Int,firstName: String, lastName: String) | |
object PersonRepository { | |
private val people = Map( | |
1 -> Person(1,"Shah","Dave"), | |
2 -> Person(2,"Barington","Foo") | |
) | |
def findByIds(ids: List[Int]) : List[Option[Person]] = { | |
ids.map(id => people.get(id)) | |
} | |
} | |
val peeps = PersonRepository.findByIds(List(1,2,3)) | |
peeps.foreach(peep => println(peep)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment