异步回调
CompletableFuture future = CompletableFuture.runAsync(()-> {
System.out.println(55555);
});
<p>future.handle((o,t)-> {
System.out.println(o);
return o;
});</p>
<p>CompletableFuture future = CompletableFuture.supplyAsync(()-> {
System.out.println(55555);
return 1024;
});</p>
<pre><code> future.handle((o,t)-> {
System.out.println(o);
return o;
});
runAsync是没有返回值的,supplyAsync有返回值
评论区