[Gambas-user] Collection key

Jussi Lahtinen jussi.lahtinen at ...626...
Wed Oct 12 21:34:50 CEST 2011


> Benoit is doing his theater lessons three weeks a month...
>

OK, good for Benoit.


And I don't understand what all these mails are talking about exactly. There
> is no limit at all on collection key lengths.
>
> Only the key hash functions take into account the last eight characters of
> the
> key. But this is internal stuff, you should not be worried about that. It
> just
> speeds up collection a lot.
>

Now I'm confused.
I read this "Collection keys are now hashed with their eight last
characters." from change log,
and I tested it with following code:
*
Dim kol As New Collection(gb.Binary)

kol.Add("a", 12345678)
kol.Add("b", 123456789)
kol.Add("c", 1234567890)
kol.Add("d", 12345678901)

For Each sTmp In kol
  Print sTmp
Next*

And I did get only "d" printed. Now I re-tested this before sending it to
you, and I did get:
a
b
c
d

So there really isn't any limit!? What happened earlier??
Was this "uint hash = 0x9A177BA5 ^ len;" missing earlier?

Jussi



More information about the User mailing list