From 92fdfa2abcd09b97924c256aa4d8af1a95f703a8 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Wed, 13 Nov 2024 14:50:07 +0100 Subject: [PATCH] chore(yarn2): Map directly to a set Signed-off-by: Sebastian Schuberth --- plugins/package-managers/node/src/main/kotlin/yarn2/Yarn2.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/package-managers/node/src/main/kotlin/yarn2/Yarn2.kt b/plugins/package-managers/node/src/main/kotlin/yarn2/Yarn2.kt index f3e6b90a30475..0da767d8be1e3 100644 --- a/plugins/package-managers/node/src/main/kotlin/yarn2/Yarn2.kt +++ b/plugins/package-managers/node/src/main/kotlin/yarn2/Yarn2.kt @@ -322,7 +322,7 @@ class Yarn2( .forEach { (dependencyType, allScopedDependencies) -> allProjects.values.forEach { project -> val dependencies = allScopedDependencies[project.id] - val dependenciesInfo = dependencies?.mapNotNull { dependency -> + val dependenciesInfo = dependencies?.mapNotNullTo(mutableSetOf()) { dependency -> if ("Yarn2" in dependency.type) { val projectAsDependency = allProjects.entries.find { entry -> entry.key.type == "Yarn2" && entry.key.name == dependency.name && @@ -360,7 +360,7 @@ class Yarn2( ) } } - }?.toSet().orEmpty() + }.orEmpty() graphBuilder.addDependencies(project.id, dependencyType.type, dependenciesInfo) }