Reputation: 631
I have a hashmap where I am reading a text file and storing the unique words into key and the number of frequency of that specific word in another textfile in the value field.
Now, I have to keep track of the probability of the word occurring in another text file. I don't need to know how to calculate the probability, but however, what I need to figure out is, how do I store the probability associated with every key (word) when the value field is already taken (frequency of words).
Do you suggest I make another hashmap with the same keys but replace the values with the probability? Thanks!
Upvotes: 0
Views: 602
Reputation: 887469
You should make a class that holds both pieces of information, and store that class in a single hashmap.
Upvotes: 5