Kotlin: Comparing enums I am currently converting a project from Java to kotlin and re-writing the code in the process to make the most out of kotlin's capabilities. The project contains a Battle System which uses elements to establish inferiority/superiority or neutrality of attacks based on the attacker's and defender's element. The code is much more concise than the java version but I have the feeling there is an even better way to do it, I am just not sure what that way is, so any input would be greatly appreciated, also in regard to improvements in regard to the current code:

internal class Element {

    enum class Type {
        NEUTRAL {
            override fun superiorTo(): List&lt;Type&gt; = emptyList()
            override fun inferiorTo(): List&lt;Type&gt; = emptyList()
        },
        FIRE {
            override fun superiorTo(): List&lt;Type&gt; = listOf(EARTH)
            override fun inferiorTo(): List&lt;Type&gt; = listOf(WATER)
        },
        WATER {
            override fun superiorTo(): List&lt;Type&gt; = listOf(FIRE)
            override fun inferiorTo(): List&lt;Type&gt; = listOf(WIND)
        },
        WIND {
            override fun superiorTo(): List&lt;Type&gt; = listOf(WATER)
            override fun inferiorTo(): List&lt;Type&gt; = listOf(EARTH)
        },
        EARTH {
            override fun superiorTo(): List&lt;Type&gt; = listOf(WIND)
            override fun inferiorTo(): List&lt;Type&gt; = listOf(FIRE)
        };

        private val typeCount = Type.values().size

        abstract fun superiorTo(): List&lt;Type&gt;
        abstract fun inferiorTo(): List&lt;Type&gt;

        fun compare(defender: Type): ComparisonResult {
            val result: ComparisonResult
            if (inferiorTo().contains(defender)) {
                result = ComparisonResult.INFERIOR
            } else if (superiorTo().contains(defender)) {
                result = ComparisonResult.SUPERIOR
            } else {
                result = ComparisonResult.NEUTRAL
            }
            return result
        }
    }

    enum class ComparisonResult {
        NEUTRAL, SUPERIOR, INFERIOR
    }
}


The reason I am going for Lists instead of single types is twofold:


account for the option to have inferiorities/superiorities towards
multiple elements 
but mostly to make it easy to take the Neutral element into account and treat it just like all the others
You could use a bidirectional map. In Java syntax this would be:

BidiMap&lt;Type, Type&gt; superior = new BidiMap&lt;&gt;();
superior.put(EARTH, WIND);
superior.put(WIND, WATER);
superior.put(WATER, FIRE);
superior.put(FIRE, EARTH);


That's it. This greatly reduced the redundancy of your code, as well as the verbosity. Since it is a BidiMap, you can query it in both directions.

An alternative approach is to define an array ComparisonResult[typeCount][typeCount​] cmp and initialize that using similar calls as above, again avoiding redundancy. Then your compare method can just return cmp[this.ordinal ()][other.ordinal()].