OK, so I have an enum with about 15 types in it, representing elements such as water, grass, fire and such. I made the enum implement Comparable<E> and rewrote the compareTo method. BUT apparently compareTo is final and I am not allowed to override it. The final version of compareTo compares them based on their ordering, but there is no logical way to order the types so that the relationships are modeled correctly. For example, the ordering

WATER FIRE GRASS GROUND...

water is strong to fire, fire is strong to grass and grass is strong to ground. BUT water is also strong to ground, and grass is strong to water.....

the obvious option is to write a different method called compareTypes( Type ) or something to that effect but it feels wrong. It feels broken... I really wanted a compareTo method...

Ah, I've just read through the Comparable interface's API and it somewhat makes sense now. So what I really want is my own original method compareTypes because compareTo is designed so that it sets the elements in a specific order for sorting maps and the like. I get it. I feel better about writing my own method now. Thanks.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org