F
Frank Cisco
What determines the ordering of an unsorted hashtable?
Frank said:What determines the ordering of an unsorted hashtable?
Lothar said:AFAIR the hashcode of the key modulo the size of the internal
array, the Map.Entry-instances are stored in.
What determines the ordering of an unsorted hashtable?
What determines the ordering of an unsorted hashtable?
Mike said:And, within a hash chain, the order in which the key was added.
Roedy said:Oddly, until Java, many programmers were
unaware of it. They would use external ISAM files when a small
ram-resident HashMap would work much faster.
That's the implementation of HashMap. Possible that they changed
the internal logic of Hashtable as well when introducing HashMap,
but I'm not 100% sure (and too lazy to check now ;-)
Lew said:That's the implementation of Hashtable, too.
Was there a reason to think otherwise?
Roedy said:Determinate, but random. The order has no useful meaning. To see how
it works, look at the source code for Hashtable or HashMap. One of the
very first programs I ever wrote was a Hashtable lookup in FORTRAN. To
me the algorithm was magical, a true almost-free lunch. I still recall
choosing 149 as my prime. Oddly, until Java, many programmers were
unaware of it. They would use external ISAM files when a small
ram-resident HashMap would work much faster.
Eric Sosman said:... In short, the answer to the question you asked is "Yes."
Eric said:It's an acronym: Igoogle Sit Afor Myourself.
"ISAM" files?
You're right about hashing, but in COBOL anyway, SEARCH could use aOddly, until Java, many programmers were unaware of it.
They would use external ISAM files when a small ram-resident HashMap
would work much faster.
Dave said:You've missed the point, which was that Roedy failed to communicate
clearly by not expanding its first use in his post.
Lew said:It's a standard acronym and Roedy naturally assumed that most people
here would be familiar with it.
Mike said:People for whom COBOL and mainframes are mythical beasts from bygone ages
might well not have heard of it. You're showing your age, Lew
Of course, anyone who, on seeing an unfamiliar term in a technical
newsgroup, complains instead of Googling has an inflated view of his own
omniscience.
Dave said:Or has another reason for posting than just to find out the answer, such
as to remind the previous poster that not everyone is familiar with the
acronym they just used. In particular, that it is NOT a "standard"
acronym, as in a common textism or email-ism like LOL, or one you'd find
in the news.answers.newusers FAQ, or one that would be known to
practitioners in the field -- in a Java newsgroup, that's things like
JNI and other Java-specific things, and things like RAM and HDD that are
general technical computer-isms. COBOLisms would be expected to be known
in comp.lang.cobol, if there is such a newsgroup, but not in
comp.lang.java.
I'm not at all concerned about implementations that predate Java 2.
Any conclusions about Java drawn on such old versions are suspect.
You've missed the point, which was that Roedy failed to communicate
clearly by not expanding its first use in his post.
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.