我们可以从Java的Future对象中获取Callable对象吗?

我有一个可调用对象的列表,我正在使用这些对象来生成将来的对象的列表。我正在使用ExecutorService来同时完成Callable任务,并将结果存储为Future对象的列表。现在我想知道,有没有一种方法可以使我获得用于生成给定未来对象的原始可调用对象。


HUH函数
浏览 187回答 2
2回答

繁华开满天机

如果Future通过调用获得,则ExecutorService.invokeAll()可以依赖javadoc中记录的顺序。 * @return a list of Futures representing the tasks, in the same *         sequential order as produced by the iterator for the *         given task list, each of which has completed
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java