From 8cdd576927e6731cb07efc9054dee1ddf72d86b5 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 25 Dec 2023 01:00:43 +0100 Subject: code cleanup --- src/main/java/at/hannibal2/skyhanni/utils/ConfigUtils.kt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/main/java') 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 getEnumConstantFromLegacyId( legacyId: Int, enumClass: Class - ): T? where T : Enum, T : HasLegacyId { - for (enumConstant in enumClass.getEnumConstants()) { - if (enumConstant.legacyId == legacyId) return enumConstant - } - return null - } + ): T? where T : Enum, T : HasLegacyId = enumClass.getEnumConstants().firstOrNull { it.legacyId == legacyId } /** * Migrates an Int to an Enum Constant. -- cgit