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

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

The newest version!
package io.shiftleft.passes

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

class ParallelIteratorExecutor[T](iterator: Iterator[T]) {
  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