aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/ConfigUtils.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/ConfigUtils.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ConfigUtils.kt7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ConfigUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ConfigUtils.kt
index 99ed4b231..3d8fd5449 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ConfigUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ConfigUtils.kt
@@ -40,12 +40,7 @@ object ConfigUtils {
private fun <T> getEnumConstantFromLegacyId(
legacyId: Int,
enumClass: Class<T>
- ): T? where T : Enum<T>, T : HasLegacyId {
- for (enumConstant in enumClass.getEnumConstants()) {
- if (enumConstant.legacyId == legacyId) return enumConstant
- }
- return null
- }
+ ): T? where T : Enum<T>, T : HasLegacyId = enumClass.getEnumConstants().firstOrNull { it.legacyId == legacyId }
/**
* Migrates an Int to an Enum Constant.