You need to look at the full method signatures:
CompletableFuture<Void> thenAccept(Consumer<? super T> action)
<U> CompletableFuture<U> thenApply(Function<? super T,? extends U> fn)
thenAccept
takes a Consumer
and returns a T=Void
CF, i.e. one that does not carry a value, only the completion state.
thenApply
on the other hand takes a Function
and returns a CF carrying the return value of the function.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…