为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

HUH函数 2021-04-05 16:15:40
我有一个可调用对象的列表,我正在使用这些对象来生成将来的对象的列表。我正在使用ExecutorService来同时完成Callable任务,并将结果存储为Future对象的列表。现在我想知道,有没有一种方法可以使我获得用于生成给定未来对象的原始可调用对象。
查看完整描述

2 回答

?
繁华开满天机

TA贡献1816条经验 获得超4个赞

如果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


查看完整回答
反对 回复 2021-04-14
  • 2 回答
  • 0 关注
  • 186 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信