Alexander Veit wrote:
Christian Kloner wrote:
so a fix would be:
====================================
    public boolean equals(Object o) {
        return ((o != null) && (o.getClass() == OMNamespaceImpl.class))
               ? uri.equals(((OMNamespaceImpl) o).uri)
               : false;
    }
====================================


Yes. But be aware that overriding java.lang.Object#equals(Object) requires overriding java.lang.Object#hashCode():

    public int hashCode() {
        return uri == null ? 0 : uri.hashCode();
    }

These changes affect OMNamespaceImpl's behaviour when being added to certain collections such as java.util.HashSet. Some entries may suddenly disappear at runtime. So think twice before doing this ;-)

effective java programming (concerning equals/hashCode contract) :) :D, thank you. long time ago as i did this. :)




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to