mirror of
https://github.com/revanced/revanced-patcher
synced 2025-01-27 01:28:36 +01:00
perf: use Set instead of List since there are no dupes
This commit is contained in:
parent
5bd416b409
commit
e65ebd27c2
@ -43,15 +43,14 @@ 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>()
|
||||
val classes = mutableSetOf<String>()
|
||||
for (classDef in dexFile.classes) {
|
||||
if (classes.contains(classDef.type)) {
|
||||
if (classes.add(classDef.type)) { // has duplicate
|
||||
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 New Issue
Block a user