Skip to content
Advertisement

Tag: equals

How could a LinkedHashMap fail to find an entry produced by an iterator?

Under what circumstances given a correct implementation of hashCode and equals() can the following code return false? Answer Most likely scenario I can think of would be even though hashCode is “deterministic”, it may be based on mutable fields. If you change the fields used to compute hashCode after it’s put in the Map, then you won’t be able to

java.lang.Comparable and equals

If I implement java.lang.Comparable for a class, do I still have to override the equals() method? Or will the Comparable work for equals as well? If the answer is no, then what if some discrepancy arises? Let’s say the way I term two objects as equal within the equals() method is different from the way I term two objects of

Generated equals in Webservice Stub

All the generated webservice-stubs from our backend have an equals-method similar to this one: Can someone please explain to me the purpoise of __equalsCalc? I just don’t get it. It is not used somewhere else in the class. The way I see it, it is not null exactly during the calculation of the “equality”. However the equals is declared synchronized.

Advertisement