This is for both Java and Kotlin. Such a code can lead to bugs easily in case the order of the enum values change, or items get removed/replaced.