Is there any reason why a Java string cannot be tested for equality using it's hashCode method? So basically, instead of....
"hello".equals("hello")
You could use...
"hello".hashCode() == "hello".hashCode()
This would be useful because once a string has calculated it's hashcode then comparing a string would be as efficient as comparing an int as the string caches the hashcode and it is quite likely that the string is in the string pool anyway, if you designed it that way.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…