Trying to get my head around using functions as arguments to methods. For a simple example let's use:
case class IntegrationOption(id: Option[Long], name: String, iconUrl: String)
val availableOptions = List(
IntegrationOption(Some(1), "blah1", "dsaadsf.png"),
IntegrationOption(Some(2), "blah2", "dsaadsf.png")
)
I want to pass in a function to something like this:
def getIntegrationOption(ARG) = {
availableOptions.find(ARG)
}
where ARG might be:
x => x.id == Option(id)
or
x => x.name == "blah1"
Ideas? Thoughts?