From 616d14f0097c1ee7ba6dc07be417590f6418e8e5 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Fri, 3 Nov 2023 02:02:28 +0100 Subject: [PATCH] perf: Use a `HashSet` to check for included and excluded patches --- src/main/kotlin/app/revanced/cli/command/PatchCommand.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt b/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt index 34ba6eb..0603783 100644 --- a/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt +++ b/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt @@ -37,7 +37,7 @@ internal object PatchCommand : Runnable { @CommandLine.Option( names = ["-i", "--include"], description = ["List of patches to include."] ) - private var includedPatches = arrayOf() + private var includedPatches = hashSetOf() @CommandLine.Option( names = ["--ii"], @@ -48,7 +48,7 @@ internal object PatchCommand : Runnable { @CommandLine.Option( names = ["-e", "--exclude"], description = ["List of patches to exclude."] ) - private var excludedPatches = arrayOf() + private var excludedPatches = hashSetOf() @CommandLine.Option( names = ["--ei"], @@ -200,7 +200,7 @@ internal object PatchCommand : Runnable { // Warn if a patch can not be found in the supplied patch bundles. if (warn) patches.map { it.name }.toHashSet().let { availableNames -> - arrayOf(*includedPatches, *excludedPatches).filter { name -> + (includedPatches + excludedPatches).filter { name -> !availableNames.contains(name) } }.let { unknownPatches ->