implicit def option2List[V1, V2]()

in bijection-core/src/main/scala-2.13+/com/twitter/bijection/CollectionInjections.scala [40:50]


  implicit def option2List[V1, V2](implicit
      inj: Injection[V1, V2]
  ): Injection[Option[V1], List[V2]] =
    new AbstractInjection[Option[V1], List[V2]] {
      def apply(opt: Option[V1]) = opt.map(inj).toList
      def invert(l: List[V2]) = l match {
        case h :: Nil => inj.invert(h).map { Some(_) }
        case Nil      => Success(None)
        case _        => InversionFailure.failedAttempt(l)
      }
    }