Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait Result
- trait BatchableOp[T <: BatchableOp[T]] {
- def resolve(batch: Vector[T]): Vector[Result]
- }
- def execute(operations: Vector[BatchableOp[_]]): Vector[Result] = {
- def helper[T <: BatchableOp[T]](clazz: Class[T], batch: Vector[T]): Vector[Result] =
- batch.head.resolve(batch)
- operations
- .groupBy(_.getClass)
- .toVector
- .flatMap { case (clazz, batch) => helper(clazz, batch)}
- }
Add Comment
Please, Sign In to add comment