I see this reasoning, but in this case we are talking about Java
objects, and as such the should follow Java statndards (from the Javadoc
for java.lang.Object, j2se v 1.4.1):
public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.
The equals method implements an equivalence relation:
It is reflexive: for any reference value x,
x.equals(x) should return true.
It is symmetric: for any reference values x and
y, x.equals(y) should return
true if and only if y.equals(x) returns
true.
It is transitive: for any reference values x,
y, and z, if x.equals(y) returns true and y.equals(z) returns
true, then x.equals(z) should return
true.
It is consistent: for any reference values x and y, multiple invocations
of x.equals(y) consistently return true or consistently return
false, provided no information used in
equals comparisons on the object is modified.
For any non-null reference value x,
x.equals(null) should return false.
Anyone else have any thoughts here?
Russell
On Fri, 2002-09-13 at 17:24, Ben Walding wrote:
> I was browsing some Oracle newsgroups, because Oracle is fairly strict
> on this and apparently... (I don't have the standard so I can't check...)
>
> ANSI demands that X <comp> Y returns UNKNOWN if X and/or Y is NULL. Not True, Not
>False, but Unknown.
>
>
> So the behaviour in ComboKey could be representing that standard, but at
> the very least it should be mentioned as a reason in the javadoc.
>
> J. Russell Smyth wrote:
>
> >Is there a reason that ComboKey.equals() will not allow a true result if
> >any of the component keys are null? Wouldnt two ComboKeys with a nulls
> >in the same places and the same values otherwise be equal? This is the
> >action of looseEquals, but I cannot see the reason this is "loose"
> >
> >
> >
> >
> >--
> >To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> >
> >
> >
> >
>
>
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>