Depending on your use case, you can either match each argument separately (so you’d have x match {...}, y match { ... } and z match { ... } somewhere in the body), our you can put the values into a tuple and match against it, e.g.
def generalSize (x: Any, y: Any, z: Any) = (x,y,z) match {
case (s1: String, s2: String, s3: String) => (s1+s2+s3).length
case (m1: Map[_, _], m2: Map[_,_], m3: Map[_,_]) => m1.size + m2.size + m3.size
case _ => -1
}