Skip to content

Commit

Permalink
perf: Use a HashSet to check for included and excluded patches
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Nov 3, 2023
1 parent b2055ce commit 616d14f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/kotlin/app/revanced/cli/command/PatchCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal object PatchCommand : Runnable {
@CommandLine.Option(
names = ["-i", "--include"], description = ["List of patches to include."]
)
private var includedPatches = arrayOf<String>()
private var includedPatches = hashSetOf<String>()

@CommandLine.Option(
names = ["--ii"],
Expand All @@ -48,7 +48,7 @@ internal object PatchCommand : Runnable {
@CommandLine.Option(
names = ["-e", "--exclude"], description = ["List of patches to exclude."]
)
private var excludedPatches = arrayOf<String>()
private var excludedPatches = hashSetOf<String>()

@CommandLine.Option(
names = ["--ei"],
Expand Down Expand Up @@ -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 ->
Expand Down

0 comments on commit 616d14f

Please sign in to comment.