0
미래를 반환하는 함수를 작성하려고합니다. 이 미래에 3 가지의 다른 미래 기능이 호출되며, 세 번째 기능은 처음 두 가지 결과에 따라 달라집니다. 내 본능은 comphrension 위해를 사용하는 것입니다,하지만 난 튜플에 일치 할 때이 오류가 얻을 :이해를위한 튜플 내 일치
value map is not a member of Object
그것은에 의해 해결 될 수
def future1 = Future { ... }
def future2 = Future { ... }
def future3(a, b): Future[T] = Future { .... }
def future4: Future[T] = {
for {
result1 <- future1
result2 <- future2
result3 <- (result1, result2) match {
case (x, y) => future3(result1, result2)
case (_, _) => ???
}
} yield result3
}
패턴 일치를'future3' 함수로 옮기시겠습니까? – michaJlS
그래, 고마워. –