3 ms·
Java Futures are lobotomized. What is really nice is to treat Futures as monads (as in Scala, and FP languages like Haskell). Then you can chain them together
by kagakuninja 4y ago
Java Futures are lobotomized.
What is really nice is to treat Futures as monads (as in Scala, and FP languages like Haskell). Then you can chain them together using calls to flatMap aka bind. Then you can use for-comprehensions (or the equivalent):
for {
a <- taskA
b <- taskB
c <- taskC
} yield a + b + c
There are a ton of other fancy tricks found in Haskell or libraries such as Cats.