Question: I am trying to build a word-based-game application in Java. I browsed through some existing questions and got some idea how to get wordlist. Some of the questions I have referred to:

[How to pick a random english word from a list](https://stackoverflow.com/questions/594273/random-word-generator)

[Random word selection](https://stackoverflow.com/questions/3689645/random-word-selection)

My motive is to generate a random word. After getting the wordlist downloaded as a text file, I am trying to generate a 

```
Map<String, Integer> m = new HashMap<String, Integer>();

```

which could give me a word since I could query it using a random integer generated.

Is this a recommended approach or is there a better way to generate a random word from the wordlist?

Thanks.

Answer: 
Stick the word list into an array or `ArrayList`, and pick a random index. `ArrayList` is easier to work with since it can grow dynamically as you're reading your dictionary file.
you could use List or even an String array and fill it with big words list and then generate random number and then select the word from the list using that random number as index.