@@ -18,7 +18,7 @@ class TestCallback extends AnalysisCallback
1818 val classNames = scala.collection.mutable.Map .empty[File , Set [(String , String )]].withDefaultValue(Set .empty)
1919 val apis : scala.collection.mutable.Map [File , Seq [ClassLike ]] = scala.collection.mutable.Map .empty
2020
21- def usedNames = usedNamesAndScopes.mapValues(_.map(_.name))
21+ def usedNames = usedNamesAndScopes.view. mapValues(_.map(_.name)).toMap
2222
2323 override def startSource (source : File ): Unit = {
2424 assert(! apis.contains(source), s " startSource can be called only once per source file: $source" )
@@ -68,24 +68,24 @@ object TestCallback {
6868 localInheritance : Map [String , Set [String ]])
6969 object ExtractedClassDependencies {
7070 def fromPairs (
71- memberRefPairs : Seq [(String , String )],
72- inheritancePairs : Seq [(String , String )],
73- localInheritancePairs : Seq [(String , String )]
71+ memberRefPairs : collection. Seq [(String , String )],
72+ inheritancePairs : collection. Seq [(String , String )],
73+ localInheritancePairs : collection. Seq [(String , String )]
7474 ): ExtractedClassDependencies = {
7575 ExtractedClassDependencies (pairsToMultiMap(memberRefPairs),
7676 pairsToMultiMap(inheritancePairs),
7777 pairsToMultiMap(localInheritancePairs))
7878 }
7979
80- private def pairsToMultiMap [A , B ](pairs : Seq [(A , B )]): Map [A , Set [B ]] = {
80+ private def pairsToMultiMap [A , B ](pairs : collection. Seq [(A , B )]): Map [A , Set [B ]] = {
8181 import scala .collection .mutable .{ HashMap , MultiMap }
8282 val emptyMultiMap = new HashMap [A , scala.collection.mutable.Set [B ]] with MultiMap [A , B ]
8383 val multiMap = pairs.foldLeft(emptyMultiMap) {
8484 case (acc, (key, value)) =>
8585 acc.addBinding(key, value)
8686 }
8787 // convert all collections to immutable variants
88- multiMap.toMap.mapValues(_.toSet).withDefaultValue(Set .empty)
88+ multiMap.toMap.view. mapValues(_.toSet).toMap .withDefaultValue(Set .empty)
8989 }
9090 }
9191}
0 commit comments