Strings in Switch
Paul Benedict
pbenedict at apache.org
Mon Dec 7 14:43:26 PST 2009
I see that syntactic sugar assumes that the compiler and the runtime
environment both use the same string hashing algorithm. As noted, the
algorithm has never changed since at least JDK 1.2. Even if unlikely,
I don't feel comfortable with this assumption - I do not have an
alternative to propose either -- but I thought it was worth voicing.
Regardless, I see this as a pure detail of one possible
implementation. Another implementation may not choose to use hash
codes at all. Am I correct, or am I wrong and the JLS change will
mandate the use of hashCode for switching?
Paul
More information about the coin-dev
mailing list