Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: async suffix

...

Code Block
languagejava
var i = Integer.parseInt("42");
var s = "Hello".substring(0, 3);
var list = Arrays.asList(1, 2, 3);        
var map = getMapping(); // some method invocation
var val = map.get(42);


4 Async API Guidelines

4.1 All async methods should have async  suffix

Async method is a method that returns Future , CompletableFuture , or CompletionStage .

In some cases, both sync and async variants exist, and async  suffix is used to distinguish them:

Code Block
languagejava
void upsert(@Nullable Transaction tx, @NotNull R rec);

CompletableFuture<Void> upsertAsync(@Nullable Transaction tx, @NotNull R rec);

In other cases, only async variant may be present, but it should have the async  suffix anyway.

4.2 Public APIs should return CompletableFuture - not CompletionStage 

Appendix B: Practices

1 Using Stream API

...