def typedPatternMatching(any: Any): String = { any match { case string: String => s"I'm a string. My value: $string" case integer: Int => s"I'm an integer. My value: $integer" case double:Double => s"$double" case list: List[Any] if (list.size <= 10) => "Guards" case List(0, _, _) => "a three-element list with 0 as the first element" case List(1, _*) => "a list beginning with 1, any number of elements" case Vector(1, _*) => "a vector starting with 1, any number of elements" case map: Map[_, _] => map.keys.toString() case (a, b) => s"got $a and $b" case _ => s"I'm from an unknown type. My value: $any" } }