I am trying to learn more about using HashMaps in java. I would like to write a program that searches through a list of jumbled words from one text file and returns the unscrambled word(s) from another text file. Any suggestions how to do this?
coolsport04 0 Newbie Poster
Recommended Answers
Jump to PostThis will really depend on what you're trying to do.
A hashmap will be beneficial when you already know what things belong together (key, value pairs).Will the program need to unscramble (or scramble) the words?
Jump to PostOK, so in what capacity do you want to use the hash table?
Do you want it to hold both the scrambled AND the unscrambled word, so when it is presented with a scrambled word, it will just return the "value" of the unscrambled word?
...or will you try to …
Jump to PostSo is this what you mean?
1. Write a method to sort the letters of a word and return the sorted word
2. Read a file of real words
3. For each real word call sort, then add the sorted word as key and the real word as value to …
Jump to PostOK, maybe I was trying to solve a more difficult problem, where you don't know the scrambled words in advance, but can find the unscrambled word from any scrambled version of it.
So, back to your version...
HashMaps are not in any defined order, it makes no sense to put …
All 14 Replies
thines01 401 Postaholic Team Colleague Featured Poster
coolsport04 0 Newbie Poster
thines01 401 Postaholic Team Colleague Featured Poster
coolsport04 0 Newbie Poster
thines01 401 Postaholic Team Colleague Featured Poster
coolsport04 0 Newbie Poster
thines01 401 Postaholic Team Colleague Featured Poster
coolsport04 0 Newbie Poster
thines01 401 Postaholic Team Colleague Featured Poster
coolsport04 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
coolsport04 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
thines01 401 Postaholic Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.