On Tue, 2006-05-23 at 10:54 +0100, sebb wrote:
> I think the equals() here is saying that any two instances of your
> class are equal.

Protocol socket factories are effectively meant to be used as
singletons. All instances of the same socket factory class share the
same identity. So, the #equals implementation below is okay

Oleg

> 
> If this is really what is intended, then the hash code might as well
> be coded as:
> 
> public int hashCode() {
>       return 47;
> }
> 
> S///
> On 23/05/06, Abele Zhang <[EMAIL PROTECTED]> wrote:
> > Hi Roland,
> >
> > I searched the mail list, looks like there was a bug tickect for  not
> > having hashcode and equals.
> > Here is the code snippet for equals and hash. I didn't change a thing,
> > not even the class name.  I just moved it to my own package. Is this
> > looks fine?
> > __________________________
> >    public boolean equals(Object obj) {
> >        return ((obj != null) &&
> > obj.getClass().equals(EasySSLProtocolSocketFactory.class));
> >    }
> >
> >    public int hashCode() {
> >        return EasySSLProtocolSocketFactory.class.hashCode();
> >    }
> > __________________________
> >
> > Thanks a lot.
> >
> > Abele
> >
> > ---------------------------------------------------------------------
> > 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]
> 
> 


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

Reply via email to