hi i've got a problem with hash maps
currently i've got a hash map holding words as the keys and count (the number of times the word occurs) as the value.
i would also like to add another column called weights so it would look like
word#1 count#1 weight#1
word#2 count#2 weight#2
word#3 count#3 weight#3
word#4 count#4 weight#4
etc etc etc
i've heard of a couple of ways to do this:
i could either have a single hash map holding words (key) and a 2 element array (value), where the array holds 2 integers, count and weight.
or have two hash maps
one holding words (key) and count (value) and the other holding words (key) and weight (value). and combine them when they are called.
if there is any other simpler way of doing this i would love to know it. if not i am totally stuck as to how to implement either of the above ideas. so a few pointers would be great
finally count needs to be multipled by weight to give a total
cheers
currently i've got a hash map holding words as the keys and count (the number of times the word occurs) as the value.
i would also like to add another column called weights so it would look like
word#1 count#1 weight#1
word#2 count#2 weight#2
word#3 count#3 weight#3
word#4 count#4 weight#4
etc etc etc
i've heard of a couple of ways to do this:
i could either have a single hash map holding words (key) and a 2 element array (value), where the array holds 2 integers, count and weight.
or have two hash maps
one holding words (key) and count (value) and the other holding words (key) and weight (value). and combine them when they are called.
if there is any other simpler way of doing this i would love to know it. if not i am totally stuck as to how to implement either of the above ideas. so a few pointers would be great
finally count needs to be multipled by weight to give a total
cheers