Skip to content

Commit 3f7072f

Browse files
committed
Refactor: simplify creation of previousPkMap using associateBy
1 parent a75b4d1 commit 3f7072f

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

core/src/main/kotlin/org/evomaster/core/sql/SqlActionUtils.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,11 @@ object SqlActionUtils {
175175

176176
// Collect all unique Ids and their associated table IDs
177177
val previousSqlActions = actions.subList(0, i)
178-
val previousPkMap = mutableMapOf<Long, TableId>()
179-
previousSqlActions.forEach { action ->
180-
action.seeTopGenes()
181-
.flatMap { it.flatView() }
182-
.filterIsInstance<SqlPrimaryKeyGene>()
183-
.forEach { previousPkMap[it.uniqueId] = it.tableName }
184-
}
178+
val previousPkMap = previousSqlActions
179+
.flatMap { it.seeAllGenes() }
180+
.filterIsInstance<SqlPrimaryKeyGene>()
181+
.associateBy ( { it.uniqueId} ,{ it.tableName })
182+
185183

186184
// Check each foreign key constraint defined in the table
187185
for (fkConstraint in currentAction.table.foreignKeys) {

0 commit comments

Comments
 (0)