Please Give Me Example How To Use Code Similar To ExecutorService on Kotlin?

Hi Kotlin Community ,

So i working on project in intelij, in my project i create library so everytime developer execute a function must throught my library to control the flow…

So my library have a function to pushAction but the problem is my library can handle just 1 pushAction (synchronous) , i want to make it asynchronous , in java i use executorservice but in kotlin because i am new i dont know what to do ? Can u give me example how to handle case like me ?

Normally, on JVM you can call Java classes from Kotlin. I’m not doing Android, but I assume it’s the same. So you could use the ExecutorService from Kotlin as you do in Java.

1 Like

yes, but i currently build multiplatform library for android and ios , i dont know if i using java library i can implement in ios too

I suggest looking at Kotlin coroutines: