1. snapshotFlow 1. snapshotFlow fun snapshotFlow(block: () -> T): Flow Create a Flow from observable Snapshot state. (e.g. state holders returned by mutableStateOf.) snapshotFlow creates a Flow that runs block when collected and emits the result, recording any snapshot state that was accessed. While collection continues, if a new Snapshot is applied that changes state accessed by block, the flow..
Trial List 예제0 : Flow basic 예제1 : Flow basic2 예제2 : SharedFlow basic 예제3 : Coroutine basic 예제4 : Coroutine Flow 예제5 : Coroutine flow for Testing(updated at 2022-11-24) 예제6 : Suspend function안에 async methods를 parallelly operating (updated at 2022-12-5) 예제7 : Custom Deferred Method using CompletableDeferred at Suspend function (updated at 2022-12-6) 예제0 : Flow basic MockServer에 n개의 RequestValue를 요..
https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/ kotlinx-coroutines-core Core primitives to work with coroutines. Coroutine builder functions: Coroutine dispatchers implementing CoroutineDispatcher: More context elements: Synchronization primitives for coroutines: Top-level suspending functions: NameDescriptiondelayNon-blocking kotlin.github.io SharedFlow shareIn onSubscripti..
0> Coroutines guide Coroutines guide | Kotlin kotlinlang.org 1> kotlin은 async, await 가 standard library에 없고, suspending function 또한 future, promises에 비해 관리가 복잡하다. 2> kotlinx.coroutines library에 다양한 구현이 있으니 이를 사용하자 1> Coroutines basics 1. 코루틴은 어느 한 스레드에 종속되지않고 이리저리 옮겨다니면서 실행되는 computation suspend 기능을 갖춘 인스턴스다 2. 런치는 코루틴을 생성한다. 코드 블록내에서 런치 블록은 독립적으로 동작한다 3. 런블록킹은 코루틴블록이 아닌 공간에 코루틴이 동작하는 가교역할을 하는 코..
def checkforSimpleFunctional(p:Int, q:Int, test : (Int, Int) => Double) = test(p, q) println(checkforSimpleFunctional(2, 3, (a:Int, b:Int) => a + b))
fun checkforSimpleFunctional(p:Int, q:Int, test : (Int, Int) -> Double):Double{ return test(p, q) } println(checkforSimpleFunctional(2, 3){ a, b -> (a + b).toDouble() })