Execute Future.sequence with custom ExecutionContext

☆樱花仙子☆ 提交于 2019-12-05 08:03:22

Future.sequence needs a CanBuildFrom to build the collection inside the Future it returns. Many other methods in the standard library require a CanBuildFrom, for example most map methods in the collections API.

Future.sequence's implicit parameter list consists of two parameters, and both must be present in any invocation. To specify one explicitly and the other implicitly, use implicitly. For example:

val zz: Future[List[Int]] = Future.sequence(my)(implicitly, ec)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!