Fritz
On 5/10/06, klutz <[EMAIL PROTECTED]> wrote:
You need to override the equals method on Proposition : ( Collections
use the equals method to check for equality )
You have to take care when you override the equals method that you
implement the contract of the equals method properly... ( Check the
JavaDoc on java.lang.Object )...
If you don't... you get some VERY funky behaviour on collections... :)
.... this SHOULD implement the contract of equals() correctly... just
give it another pair of eyballs...
public boolean equals( Object o ) {
if ( ! o instanceof Proposition ) {
return false;
}
if ( o == null ) {
return false;
}
return ObjectUtils.equals(getName(),other.getName());
}
ObjectUtils is part of commons-lang and takes care of all the
additional null checking...
The lazy developers friend.. :):):)
Cheers,
Renier
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CTJUG Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/CTJUG-Forum
For the ctjug home page see http://www.ctjug.org.za
-~----------~----~----~----~------~----~------~--~---
- [CTJUG Forum] Help with comparing generics Fritz Meissner
- [CTJUG Forum] Re: Help with comparing generics Renier Rhode
- [CTJUG Forum] Re: Help with comparing generics klutz
- [CTJUG Forum] Re: Help with comparing generics Fritz Meissner
- [CTJUG Forum] Re: Help with comparing generics klutz
- [CTJUG Forum] Re: Help with comparing generics Fritz Meissner
- [CTJUG Forum] Re: Help with comparing gene... klutz
- [CTJUG Forum] Re: Help with comparing... Fritz Meissner
- [CTJUG Forum] Re: Help with compa... Fritz Meissner
- [CTJUG Forum] Re: Help with c... Jeff Mutonho
- [CTJUG Forum] String.replaceA... Java Mad
- [CTJUG Forum] Re: String.repl... Jeff Mutonho
- [CTJUG Forum] Re: String.repl... Jeff Mutonho
- [CTJUG Forum] Re: String.repl... Java Mad
