The Version.equals(Version) method will continue to
work as expected as long as you are also implementing
the Version.equals(Object) method.

I like the type safety of everything, but you do need
to do something like this:

boolean Version.equals(Object obj)
{
    if ( obj instanceof Version)
    {
        return this.equals((Version) obj);
    }

    if ( obj instanceof String)
    {
        return this.equals((String) obj);
    }

    return false;
}

boolean Version.equals(String verString)
{
    return this.equals( new Version( verString ) );
}

....

That way, you can look up a version object through
the Collections enterfaces or anything that looks up
generic objects.

Also, it allows you to store things by Version, but
access them by String....


--- Paulo Gaspar <[EMAIL PROTECTED]> wrote:
> Well, considering the default implementation of
>   boolean equals(Object obj)
> 
> it will still all work properly anyway.
> 
> Have fun,
> Paulo
> 
> > -----Original Message-----
> > From: Peter Donald [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, September 14, 2001 4:58 PM
> > To: Avalon Development
> > Subject: Re: Why Version.equals( final Version
> other )?
> > 
> > 
> > On Fri, 14 Sep 2001 23:13, Paulo Gaspar wrote:
> > > > Well I like the type safety, however you could
> also easily implement
> > >
> > > But Peter, since any class inherits a method
> > >   boolean equals(Object obj)
> > >
> > > from Object, you still have no type safe
> equals() method just by
> > > implementing
> > >   boolean equals( final Version other )
> > 
> > true. I guess it is just a habit then ;)
> > 
> > -- 
> > Cheers,
> > 
> > Pete
> > 
> > ------------------------------------------
> > I just hate 'yes' men, don't you Smithers?
> > ------------------------------------------
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com

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

Reply via email to