In scala gibt es eine einfache Möglichkeit, ein optionales Tupels in ein Tupel von Optionen zur Transformation d.hOptional Tupel Tupel von Optionen
Option[(Int, Int)] => (Option[Int], Option[Int])
Dank
P. S. Ich bin jetzt gerade mit:
val myTuple: Option[(Int, Int)] = Some((1, 1))
if (myTuple.isDefined)
(Some(myTuple.get._1), Some(myTuple.get._2))
else
(None, None)
Was haben Sie versucht? Ich werde das sowieso beantworten, aber es wäre nett, wenn du zuerst niederlegst, was du versucht hast. – wheaties
Sorry, ich habe meinen aktuellen Code hinzugefügt –