All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.shiftleft.passes.ParallelIteratorExecutor.scala Maven / Gradle / Ivy

There is a newer version: 1.7.13
Show newest version
package io.shiftleft.passes

import scala.concurrent.duration.Duration
import scala.concurrent.{Await, ExecutionContext, Future}

class ParallelIteratorExecutor[T](iterator: Iterator[T])(implicit executionContext: ExecutionContext) {
  def map[D](func: T => D): Iterator[D] = {
    val futures = Future.traverse(iterator) { element =>
      Future {
        func(element)
      }
    }
    Await.result(futures, Duration.Inf)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy