B
Boris Punk
Hi
Could someone tell me what determines the order of the keys in a hashtable?
Could someone tell me what determines the order of the keys in a hashtable?
"Boris Punk said:Hi
Could someone tell me what determines the order of the keys in a hashtable?
Kevin said:If the JavaDoc doesn't state an order then it's a mix of JVM version,
initial table size, insertion order, and _lots_ of bit hashing. After
all, a hashing algorithm works best when it eliminates bucket mapping
patterns.
Use something like LinkedHashMap or TreeMap if order matters.
Boris said:Hi
Could someone tell me what determines the order of the keys in a hashtable?
Boris said:Something I've noticed without digging into the code-that key strings that
are almost the same apart from 1 character are next to each other-figure
that one out!
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.