June 2018
Intermediate to advanced
310 pages
6h 32m
English
Now our data class is the Barrier:
val character = FavoriteCharacter(getName().await(), getCatchphrase().await(), getRepeats().await())// Will happen only when everything is readywith(character) { println("$name says: ${catchphrase.repeat(repeats)}") }
The additional benefit of data classes as Barriers is the ability to destructure them easily:
val (name, catchphrase, repeats) = characterprintln("$name says: ${catchphrase.repeat(repeats)}")
This works well if the type of data we receive from different asynchronous tasks is widely different. In this example, we receive both String and Int.
In some cases, we receive the same types of data from different sources.
For example, let's ask Michael (our canary product owner), ...
Read now
Unlock full access