Skip to content

Instantly share code, notes, and snippets.

@danielkec

danielkec/ma8.java

Created Mar 20, 2020
Embed
What would you like to do?
AtomicInteger sum = new AtomicInteger();
ReactiveStreams.of("1", "2", "3", "4", "5")
.limit(3)
.map(Integer::parseInt)
.forEach(sum::addAndGet)
.run()
.whenComplete((r, t) -> System.out.println("Sum: " + sum.get()));
> Sum: 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment