C
CodeForTea
in fact, you provide an example of use of what I was talking about...
Here is some code showing equals and hascode that you can implement in
your calsses. [snip]
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
This piece of code is more or less equivalent to calling my
"areEqual(name, other.name)" (except that I prefer my version, sorry).
So basically, you're answering my need for factorization with "don't
factorize, write it".
Thanks all the same
JR
public class Utils {
public static boolean areEqual(Object obj1, Object obj2) {
return (obj1 == null) ? (obj2 == null) : (obj1.equals(obj2));
}
}
I fail to see how this helps. Why do you need two methods to compare
an object when one will do? You call the equals method in your
areEqual method.
Dinesh