使用scala的流式工作日
我对play还比较陌生,我想开发一个函数,随机异步返回一些工作日。我的方法最好有以下签名:使用scala的流式工作日,scala,streaming,Scala,Streaming,我对play还比较陌生,我想开发一个函数,随机异步返回一些工作日。我的方法最好有以下签名: def randomlyEndingStream: Future[Option[String]] 有关于如何进行的提示吗 谢谢返回日期时也需要随机吗? def maybeGiveSomeWeekday:Future[Option[String]] = { Future.successful(Random.nextInt(8) match{ case 0 => Some("Mon
def randomlyEndingStream: Future[Option[String]]
有关于如何进行的提示吗
谢谢返回日期时也需要随机吗?
def maybeGiveSomeWeekday:Future[Option[String]] = {
Future.successful(Random.nextInt(8) match{
case 0 => Some("Monday")
case 1 => Some("Tuesday")
case 2 => Some("Wednesday")
case 3 => Some("Thursday")
case 4 => Some("Friday")
case 5 => Some("Saturday")
case 6 => Some("Sunday")
case 7 => None
})
}