perf: Use a hash set for fast lookup

This commit is contained in:
oSumAtrIX 2023-11-28 20:17:46 +01:00
parent db5b0ed7be
commit f1de9b39ef
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
1 changed files with 2 additions and 2 deletions

View File

@ -10,7 +10,7 @@ internal object AnnotationExtensions {
fun <T : Annotation> Class<*>.findAnnotationRecursively(targetAnnotation: Class<T>): T? {
fun <T : Annotation> Class<*>.findAnnotationRecursively(
targetAnnotation: Class<T>,
searchedAnnotations: MutableSet<Annotation>,
searchedAnnotations: HashSet<Annotation>,
): T? {
val found = this.annotations.firstOrNull { it.annotationClass.java.name == targetAnnotation.name }
@ -30,6 +30,6 @@ internal object AnnotationExtensions {
return null
}
return this.findAnnotationRecursively(targetAnnotation, mutableSetOf())
return this.findAnnotationRecursively(targetAnnotation, hashSetOf())
}
}