• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

CompletedStage

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Elo everyone...

Whats difference?

`CompletionStage<U> completedStage(U value)`  and `CompletableFuture<U> completedFuture(U value)`

thank you in advance for the answers.

Best regards.
 
Sheriff
Posts: 22863
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
CompletableFuture is a class that implements interface CompletionStage. That means that anything you can do with CompletionStage, you can also do with CompletableFuture. However, CompletableFuture has some methods that aren't in CompletionStage. For instance, join() or getNow(T). For a complete list, check out the non-static methods and check for those that don't include "Specified by".

I don't really see a reason for completedStage (or failedStage. I guess they can be useful if you don't want the object to contain any of the methods of CompletableFuture, because the returned instance cannot be cast to it, but again - I don't see any reason for that.
 
Cihangir Kuce
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
that was very explanatory...

Thanks.
 
Rob Spoor
Sheriff
Posts: 22863
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome.
 
Get meta with me! What pursues us is our own obsessions! But not this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic