[antlr-interest] Question about CommonTokens in Java Hashmaps

Joachim Lusiardi joachim at lusiardi.de
Thu Jun 25 07:51:52 PDT 2009


Hi,
i have short question about org.antlr.runtime.Token instances in Java
standard collections. Since (as far as i can see from the source) the
mentioned class does not override hashCode and equals i have troubles to
use this with standard containers like HashMap or Vector.

What can i do to solve this problem? I expected that 2 CommonToken
objects have the same tokenindex, start, stop, text, type, channel, line
and charPosition in line they should be equal? and the hashCode also
should be derived from this?

Best greetings
Joachim Lusiardi


More information about the antlr-interest mailing list