https://kotlinlang.org logo
#getting-started
Title
# getting-started
a

Ansh Tyagi

11/09/2021, 5:06 PM
Hey! so is I am getting started with multiprocessing and wanted to know if there is something similar to pythons Pool.map() in kotlin?
r

Ruckus

11/09/2021, 5:26 PM
Not familiar with "multiprocessing" in Python, but you likely want to check out #coroutines and #flow.
g

gildor

11/10/2021, 4:41 AM
Right, coroutines is way to go. But also if you just want to do multi-thread processing and want efficiently split a big, cpu heavy, job you can use Java parallel streams, it’s a very efficient way to do this, but coroutines are more general solution
s

Stephan Schroeder

11/10/2021, 10:37 AM
An issue with Java parallel streams is that you don't have control over the threadpool (it's a shared threadpool for the whole application). If you need more fine-grained control, check out
ExecutorService
from the Java std/lib. But check out Coroutines first.