classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Silly Java question


From: Roman Kennke
Subject: Re: Silly Java question
Date: Tue, 27 Dec 2005 14:11:01 +0100

Hi Jeff,


> I'm just beating on the KerberosPrincipal class, and am trying to deal
> the comments given by people.
> 
> The problem I'm having is that I have a name string and a type int.
> 
> This is the comment at the top of my equals function:
> 
>    * From Section 7.2 of rfc1510: When comparing names, a name of type
>    * UNKNOWN will match principals authenticated with names of any type.
>    * A principal authenticated with a name of type UNKNOWN, however, will
>    * only match other names of type UNKNOWN.

It would be helpful to see the whole class, so that I can fully
understand the problem. Is it that the equals() comparison is in some
way not symmetrical? Does this only affect the KerberosPrincipal class
or also when comparing this class with other classes?

> But how do I encode that logic into a hashCode?  I find the C++ hacker
> in me wanting to reach out and overload operator= and solve the problem.
> =)  I just don't know enough about hashing logic to get this right
> without help.

Generally, implementing equals() is the same like overloading == in C++.
But you're right, you should get the hashCode() thing right.

/Roman

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


reply via email to

[Prev in Thread] Current Thread [Next in Thread]