On Tuesday, August 19, 2003, at 06:49 PM, Tim Blair wrote:

> That's not going to identify a function uniquely - the hashCode() 
> method will return the hashcode for the theName variable, not for the 
> function.  If I called the method again with exactly the same value, 
> it'd return a different hashcode.
>
Since theName is a concatenation of the fileName and functionName, it 
is unique and its hash code will never change. Certainly many object's 
hash code in Java are based on their memory address, which means that 
it can change over time. However, java.lang.String's is computed as...

        s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]

...using int arithmetic, where s[i] is the  ith character of the 
string, n is the length of  the string, and ^ indicates exponentiation. 
Thus, it is safe to identify strings with their hash code.

-Matt

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

Reply via email to