Nice, thanks for that link phi.lho. I will have to try it out this evening.
Since I am not too familiar with arraylist I took a look at the
arraylist and the
interface map documentation; it will take some tinkering for me to adapt my code. Though perhaps what I am after is not as exacting as the code you produced. Referring to your earlier idea of words as K and count as V (which it appears the Shiffman example is doing), is there not a simple was to reveal the max V for the keys associated with a particular word? According to the
Map documentation "the Map interface provides three collection views, which allow a map's contents to be viewed as a set of keys, collection of values, or set of key-value mappings."
I know the hashmap is an unsorted map. Though, it would seem if I have 200 keys (eg words) all called "chimpanzee" and each of these received a value (eg a count) between 1 and 200 there ought to be an easy way to interrogate this subset of keys for the max value among them (i.e., viewing via key-value mappings)?
Ok, please do tell me if I am missing something. Perhaps the keys in a hashmap, despite being linked, in this case to words, are actually each unique expressions as far as java is concerned...?