mirror of
https://github.com/revanced/revanced-cli.git
synced 2025-01-23 09:27:30 +01:00
perf: Use a HashSet
to check for included and excluded patches
This commit is contained in:
parent
b2055ce07d
commit
616d14f009
@ -37,7 +37,7 @@ internal object PatchCommand : Runnable {
|
|||||||
@CommandLine.Option(
|
@CommandLine.Option(
|
||||||
names = ["-i", "--include"], description = ["List of patches to include."]
|
names = ["-i", "--include"], description = ["List of patches to include."]
|
||||||
)
|
)
|
||||||
private var includedPatches = arrayOf<String>()
|
private var includedPatches = hashSetOf<String>()
|
||||||
|
|
||||||
@CommandLine.Option(
|
@CommandLine.Option(
|
||||||
names = ["--ii"],
|
names = ["--ii"],
|
||||||
@ -48,7 +48,7 @@ internal object PatchCommand : Runnable {
|
|||||||
@CommandLine.Option(
|
@CommandLine.Option(
|
||||||
names = ["-e", "--exclude"], description = ["List of patches to exclude."]
|
names = ["-e", "--exclude"], description = ["List of patches to exclude."]
|
||||||
)
|
)
|
||||||
private var excludedPatches = arrayOf<String>()
|
private var excludedPatches = hashSetOf<String>()
|
||||||
|
|
||||||
@CommandLine.Option(
|
@CommandLine.Option(
|
||||||
names = ["--ei"],
|
names = ["--ei"],
|
||||||
@ -200,7 +200,7 @@ internal object PatchCommand : Runnable {
|
|||||||
|
|
||||||
// Warn if a patch can not be found in the supplied patch bundles.
|
// Warn if a patch can not be found in the supplied patch bundles.
|
||||||
if (warn) patches.map { it.name }.toHashSet().let { availableNames ->
|
if (warn) patches.map { it.name }.toHashSet().let { availableNames ->
|
||||||
arrayOf(*includedPatches, *excludedPatches).filter { name ->
|
(includedPatches + excludedPatches).filter { name ->
|
||||||
!availableNames.contains(name)
|
!availableNames.contains(name)
|
||||||
}
|
}
|
||||||
}.let { unknownPatches ->
|
}.let { unknownPatches ->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user