Skip to content

Commit

Permalink
refactor(utils): Slightly re-write a function
Browse files Browse the repository at this point in the history
Avoid a conversion to a `SortedSet` and the `getValue()` made in each
iteration.

Signed-off-by: Frank Viernau <[email protected]>
  • Loading branch information
fviernau committed May 27, 2024
1 parent 2bfa41f commit d22d659
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions model/src/main/kotlin/utils/DependencyGraphBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,8 @@ private fun constructSortedScopeMappings(
): Map<String, List<RootDependencyIndex>> {
val orderedMappings = mutableMapOf<String, List<RootDependencyIndex>>()

scopeMappings.keys.toSortedSet().forEach { scope ->
orderedMappings[scope] = scopeMappings.getValue(scope)
scopeMappings.entries.sortedBy { it.key }.forEach { (scope, rootDependencyIndices) ->
orderedMappings[scope] = rootDependencyIndices
.map { it.mapIndex(indexMapping) }
.sortedWith(rootDependencyIndexComparator)
}
Expand Down

0 comments on commit d22d659

Please sign in to comment.