private[repoconfig] def mergeAllow()

in modules/core/src/main/scala/org/scalasteward/core/repoconfig/UpdatesConfig.scala [158:181]


  private[repoconfig] def mergeAllow(
      x: Option[List[UpdatePattern]],
      y: Option[List[UpdatePattern]]
  ): Option[List[UpdatePattern]] = combineOptions(x, y) { (x, y) =>
    (x, y) match {
      case (Nil, second) => second
      case (first, Nil)  => first
      case _             =>
        //  remove duplicates first by calling .distinct
        val xm: Map[GroupId, List[UpdatePattern]] = x.distinct.groupBy(_.groupId)
        val ym: Map[GroupId, List[UpdatePattern]] = y.distinct.groupBy(_.groupId)
        val builder = new collection.mutable.ListBuffer[UpdatePattern]()

        //  first of all, we only allow intersection (superset)
        val keys = xm.keySet.intersect(ym.keySet)

        keys.foreach { groupId =>
          builder ++= mergeAllowGroupId(xm(groupId), ym(groupId))
        }

        if (builder.isEmpty) nonExistingUpdatePattern
        else builder.distinct.toList
    }
  }