- How do I find the filename of a file?
You can use the
- I’m confused about how to use an
ArrayListas the value within a
HashMap. How do I create and update an
ArrayListfor each word?
Each word should map to a separate
ArrayList. When you encounter a key that isn’t already in the
HashMap, you should create a new
HashMap.put()to insert the key and its associated
ArrayList. When you want to add to the
ArrayListof a key that is already in the
HashMap, you should use
HashMap.get()to get the
ArrayList, update it, then use
HashMap.put()to put the key and the updated
ArrayListback into the
- I’m not sure how to go about not reusing words in
GladLibs. How do I make sure the new word hasn’t been used already? Where do I write this code?
Think about what type of a loop you will need – do you know how many times this loop will need to run? When will you want to stop the loop? To figure out where to add this code, think about where you generate new words and when you could check whether these have been used already.
- Why am I getting a
null pointer exceptionwhenever I try to call a method on my
Make sure you have initialized your
HashMapbefore calling methods on it. Also, if you are declaring and initializing it in different places, make sure that you have not declared it a second time when you initialize it.
LogAnalyzerclass prints out all the values correctly except for the date/time. Does the time zone setting in the computer have an impact on the output value from the
Yes, if your time zone is different from Durham, USA, you may want to temporarily change the time zone on your computer.
- Where can I find the dictionary files to use for my
The dictionary files are included in the starter program you download. They are inside the folder called ‘dictionaries’.