mirror of
https://github.com/ReVanced/revanced-patcher.git
synced 2024-11-10 09:08:04 +01:00
perf: use String List and compare instead of any lambda
This commit is contained in:
parent
32e645850d
commit
aed4fd9a3c
1 changed files with 5 additions and 2 deletions
|
@ -43,14 +43,17 @@ class Patcher(
|
|||
fun addFiles(vararg files: File, throwOnDuplicates: Boolean = false) {
|
||||
for (file in files) {
|
||||
val dexFile = MultiDexIO.readDexFile(true, files[0], NAMER, null, null)
|
||||
val classes = mutableListOf<String>()
|
||||
for (classDef in dexFile.classes) {
|
||||
if (cache.classes.any { it.type == classDef.type }) {
|
||||
// TODO: Use logger and warn about duplicate classes
|
||||
if (classes.contains(classDef.type)) {
|
||||
if (throwOnDuplicates)
|
||||
throw Exception("Class ${classDef.type} has already been added to the patcher.")
|
||||
continue
|
||||
}
|
||||
cache.classes.add(classDef)
|
||||
classes.add(classDef.type)
|
||||
}
|
||||
classes.clear()
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue