Hi there is there a way to do it better: I use 2 i...
# getting-started
g
Hi there is there a way to do it better: I use 2 int variables to split array into parts and process that parts in threads. The problems is that ints are of reference type so I do it like that:
Copy code
for (i in 1..cores) {
            val start = startIndex
            val end = endIndex
            pool.execute { task(start, end) }
            startIndex = endIndex
            endIndex = if (i < cores - 1) endIndex + length else dataSet.size
        }