completablefuture and handle()方法向后移植到java7

6za6bjd0  于 2021-07-07  发布在  Java
关注(0)|答案(0)|浏览(172)

我有一个用java 8编写的代码,使用completablefuture和handle方法:

public interface Move
{
   CompletableFuture<Boolean> move(float i);
}

然后创建move的示例mover并调用:

mover.move(i).handle(new BiFunction<Boolean, Throwable, Object>()
{
   public Object apply(Boolean b, Throwable err)
   {
      return something; //Didn't want to overwhelm the code here; in the original one a method is called
   }
}

如何使它与java7向后兼容?或者我该如何处理这个问题?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题