structHashCode doesn't work so well, either. It also returns false
positives:
<cfset foo = structNew()>
<cfset foo.a.b.c.d = '123'>
<cfset foo.b.c.d = '456'>
<cfoutput>
#createObject("java",
"java.util.Hashtable").init(foo).hashCode()#<br>
#createObject("java",
"java.util.Hashtable").init(foo.a).hashCode()#<br>
#createObject("java",
"java.util.Hashtable").init(foo.a.b).hashCode()#<br>
#createObject("java",
"java.util.Hashtable").init(foo.b).hashCode()#<br>
</cfoutput>
foo.a.b has the same hashCode as foo.b: 67.
-----Original Message-----
From: Brad Howerter
Sent: Monday, August 25, 2003 8:30 AM
To: '[EMAIL PROTECTED]'
Subject: RE: [CFCDev] cfdump problem
Nice, thank you. It'd really be better if I could tell a reference apart
from a copy, but that's probably not possible.
Is there a similar trick for objects?
-----Original Message-----
From: Samuel Neff [mailto:[EMAIL PROTECTED]
Sent: Friday, August 22, 2003 5:34 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] cfdump problem
That's strange, I was getting hashCode() values for structures when I wrote
the dumpstruct tag at work, but now I'm getting 0's at home (both CFMX 6.1).
Anyways, this code should always work, it's just a little slower (fine for
cfdump replacement).
<cfscript>
s = "my String";
writeoutput(s.hashCode() & "<br />");
d = 0.454;
writeoutput(d.hashCode() & "<br />");
st = structNew();
st['s'] = s;
writeoutput(structHashCode(st) & "<br />");
st['d'] = d;
writeoutput(structHashCode(st) & "<br />");
function structHashCode(st) {
return createObject("java", "java.util.Hashtable").init(st).hashCode();
}
</cfscript>
HTH,
Sam
----------------------------------------------
Blog: http://www.rewindlife.com
Chart: http://www.blinex.com/products/charting
----------------------------------------------
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Davis, Eric
> Sent: Friday, August 22, 2003 4:54 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [CFCDev] cfdump problem
>
> CFMX 6.1
>
> Yes, indeed, it does display zero for each structure's hashcode().
>
> --
> Eric C. Davis
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).