T
Todd
Hello,
I have recently been told that the ordinal() method in a Java enum
will not necessarily return the same value in different invocations of
the JVM. Has anyone else found this?
BTW, the semantics of the enum will stay the same, an enumerated value
that was once greater than another will continue to be so. It is just
that the absolute value of the declared enumeration will not
necessarily be the same from run to run. This indicates to me that
one would not be able to retrieve an enumerated element by a stored
ordinal value. Further, the ordinal could be a value greater than the
number of enumerated elements, making values()[ordinal()] suspect as
well.
Any insights are appreciated,
Todd
I have recently been told that the ordinal() method in a Java enum
will not necessarily return the same value in different invocations of
the JVM. Has anyone else found this?
BTW, the semantics of the enum will stay the same, an enumerated value
that was once greater than another will continue to be so. It is just
that the absolute value of the declared enumeration will not
necessarily be the same from run to run. This indicates to me that
one would not be able to retrieve an enumerated element by a stored
ordinal value. Further, the ordinal could be a value greater than the
number of enumerated elements, making values()[ordinal()] suspect as
well.
Any insights are appreciated,
Todd