Last active
March 6, 2018 23:00
-
-
Save kolov/ee7dd962faa3b932bf938bcead6ab6cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getAllDatesScala(products: List[String]) = { | |
val futureAllDates = Future.sequence(products.map(p ⇒ getDates(p))) | |
futureAllDates.map(l ⇒ | |
if (l.exists(_.isLeft)) | |
None | |
else | |
Some(l.foldLeft(List[LocalDate]())((acc, e) => | |
e match { | |
case Left(_) => acc | |
case Right(l) => acc ++ l | |
}))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment