Skip to content

Instantly share code, notes, and snippets.

View roan-wise's full-sized avatar
👽

Roan roan-wise

👽
View GitHub Profile
@roan-wise
roan-wise / Sequential.java
Created October 6, 2025 14:54
CompletableFuture behaviour
public class Main {
public static void main(String[] args) {
long start = System.currentTimeMillis();
List<Integer> data = List.of(1, 2, 3);
var processed = data.stream()
.map(task -> {
System.out.printf("Submitting %d at %d ms\n", task, System.currentTimeMillis() - start);
return CompletableFuture.supplyAsync(() -> processData(task, start));
})