What should be used instead of someMethod in the following code to get correct results?
case class case class Employee(name: String, department: String, manager: Option[String])
def lookupByName(name: String): Option[Employee] = name match {
case "Joe" => Some(Employee("Joe", "Finances", Some("Julie")))
case "Mary" => Some(Employee("Mary", "IT", None))
case "Izumi" => Some(Employee("Izumi", "IT", Some("Mary")))
case _ => None
}
lookupByName("Joe").someMethod(_.department != "IT") == Some(Employee("Joe", "Finances", Some("Julie")))
lookupByName("Mary").someMethod(_.department != "IT") == None
lookupByName("Foo").someMethod(_.department != "IT") == None
Login in to like
Login in to comment