0

I saw since Java9 CompletedStage.completedStage() is almost equals to CompletedStage.ompletedFuture()

When we must return

CompletionStage<Void>

we can return both. CompletedFuture.completedFuture() is not deprecated and in Java doc for completedStage() it is written

Returns a new CompletionStage that is already completed with the given value and supports only 
those methods in interface CompletionStage.

So what is really the difference and when have to use one instead other ? when must return Void what is better ?

CompletedFuture.completedFuture(null)

or

CompletedFuture.completedStage(null)
cyril
  • 872
  • 6
  • 29

0 Answers0