Campbell Ritchie wrote:You have not correctly overridden the hashCode() method, so you can't expect a hash-based collection class to work correctly.
By the way: the instanceof operator is only reliable in the equals() method if the class is final.
I first had overriden hashcode() too, but that didn't change the output. I had implemented it as a method that just returned the key...that should work, shouldn't it? But I'll check again.
EDIT: DOH!! I had misspelled hashCode() as hashcode(). Of course that could not work...and I thought I had misunderstood something fundamentally. Thanks for quick answer anyway