private def findExactMatches()

in common/src/main/scala/com/gu/anghammarad/common/Contacts.scala [37:46]


  private def findExactMatches(targets: List[Target], mappings: List[Mapping]): Try[Option[List[Contact]]] = {
    mappings.filter(_.targets.toSet == targets.toSet) match {
      case Nil =>
        Success(None)
      case exactMatch :: Nil =>
        Success(Some(exactMatch.contacts))
      case multipleMatches =>
        Fail(s"Found multiple exact matches while resolving contacts for $targets")
    }
  }