July 2018
Intermediate to advanced
266 pages
7h 11m
English
If you want a channel in which you are able to send an unlimited amount of elements without it suspending, then you need a LinkedListChannel. This type of channel will not suspend any senders. In order to instantiate this type of channel, you can use the constructor:
val channel = LinkedListChannel<Int>()
You can also use the Channel() function with the parameter Channel.UNLIMITED:
val channel = Channel<Int>(Channel.UNLIMITED)
This channel will never suspend a sender. So for example consider the following code:
fun main(args: Array<String>) = runBlocking { val time = measureTimeMillis { val ...
Read now
Unlock full access