alexander.ber...@finnova.ch said the following on 03/06/2009 12:04 PM: > [...] As to my understanding hashCode() should never throw an exception and > always return the same integer value for the same object instance. If this > contract is violated classes like HashMap will not work correctly, possibly > introducing memory leaks if the Map (Set or whatever) entries are not removed > due to changing hash codes or thrown exceptions. > Just as a side note: while it what you describe is probably the best practice it is not mandated by the java-spec. In fact java the classes from the collection framework would violate this contract: the hashcode changes when the collection changes and hashcode() throws an exception when the collection is self-containing.
Regards, Reto --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org