Java

CompletableFuture

Në shqip përdoret i njëjti emër.

ShpjegimiSQ

CompletableFuture është mënyra e Java-s për punë asinkrone: nis një punë në sfond dhe lidh hapat e tjerë me thenApply() dhe thenAccept() — si Promise-at e JavaScript-it.

EnglishEN

CompletableFuture is Java's way of doing async work: start a job in the background and chain the next steps with thenApply() and thenAccept() — like JavaScript Promises.

Si ta mendosh

Si porosia online: paguan, dhe „kur të vijë pakoja, njoftomë“.

Lexoje në anglisht

Like an online order: you pay, and “when the parcel arrives, notify me”.

Shembull kodijava

CompletableFuture.supplyAsync(() -> merrNotat())
    .thenApply(notat -> mesatarja(notat))
    .thenAccept(System.out::println);

Terma të lidhur