- How do I find the filename of a file?
You can use the
Filemethod.getName() - I’m confused about how to use an
ArrayListas the value within aHashMap. How do I create and update anArrayListfor each word?
Each word should map to a separate
ArrayList. When you encounter a key that isn’t already in theHashMap, you should create a newArrayListand useHashMap.put()to insert the key and its associatedArrayList. When you want to add to theArrayListof a key that is already in theHashMap, you should useHashMap.get()to get theArrayList, update it, then useHashMap.put()to put the key and the updatedArrayListback into theHashMap. - 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 myHashMap?
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. - My
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.getAccessTime()method?
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
VigenereBreaker?
The dictionary files are included in the starter program you download. They are inside the folder called ‘dictionaries’.
