Skip to content

Commit

Permalink
perf: Use a hash set for fast lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Nov 28, 2023
1 parent db5b0ed commit f1de9b3
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand All @@ -30,6 +30,6 @@ internal object AnnotationExtensions {
return null
}

return this.findAnnotationRecursively(targetAnnotation, mutableSetOf())
return this.findAnnotationRecursively(targetAnnotation, hashSetOf())
}
}

0 comments on commit f1de9b3

Please sign in to comment.