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

4u.meteor-awssdk_3.2.0.22.source-code.implicits.scala Maven / Gradle / Ivy

There is a newer version: 2.0.24
Show newest version
package meteor

import cats.effect.Async
import cats.implicits._
import meteor.errors.DecoderError

import java.util.concurrent.CompletableFuture
import java.util.{HashMap => jHashMap, Map => jMap}

private[meteor] object implicits extends syntax {
  type FailureOr[U] = Either[DecoderError, U]

  def liftFuture[F[_], A](
    thunk: => CompletableFuture[A]
  )(implicit F: Async[F]): F[A] =
    F.fromCompletableFuture(F.delay(thunk))

  implicit class JavaMap[K, V](m1: jMap[K, V]) {
    def ++(m2: jMap[K, V]): jMap[K, V] = {
      val m3 = new jHashMap[K, V](m1)

      m2.forEach {
        case (key, value) => m3.merge(
            key,
            value,
            (_: V, r: V) => r
          )
      }
      m3
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy