“+” in Kotlin Coroutines?

后端 未结 1 2005
予麋鹿
予麋鹿 2021-01-05 23:23

This is example code for a Cancellation via explicit job for Kotlin Coroutines:

fun main(args: Array) = runBlocking {
    val job =         


        
相关标签:
1条回答
  • 2021-01-05 23:50

    It’s an example of operator overloading. The following shows the documentation of method CoroutineContext::plus:

    open operator fun plus(context: CoroutineContext): CoroutineContext
    

    Returns a context containing elements from this context and elements from other context. The elements from this context with the same key as in the other one are dropped.

    It’s basically a merge of two contexts.

    0 讨论(0)
提交回复
热议问题