Back to Intellij Community

ForEachJoinOnCollectionOfJob

plugins/kotlin/code-insight/descriptions/resources-en/inspectionDescriptions/ForEachJoinOnCollectionOfJob.html

2025.3-rc-2424 B
Original Source

Reports forEach { it.join() } calls on collections of Job.

This can be replaced by a more concise and fully equivalent joinAll() call.

See the documentation for kotlinx.coroutines.joinAll for more details.

Example:

suspend fun waitForJobs(jobs: List<Job>) {
    jobs.forEach { it.join() }
  }

After the quick-fix is applied:

suspend fun waitForJobs(jobs: List<Job>) {
    jobs.joinAll()
  }