c. Write a displayLyrics method with the following signature:
public void displayLyrics (HashMap<String, ArrayList<Integer>> map)
This method will display the lyrics for the song (in uppercase) stored in the map. Start with
an empty array of strings whose size is the number of words in the lyric plus 1 (don't use
cell 0). Initialize this array with empty strings (not null). Then, get a set of all of the words
stored in the map. For each word, store the word in the array cells corresponding to its word
position(s). If a word position is negative, add on an extra newline character to the word
when you store the word in the array. Once you finish processing all words that are in the
map, iterate through the array and print out each string, and you should see the lyrics
appear, line by line. Note that if the original lyrics had blank lines, you won't have these in
the reconstructed lyrics. Iterate through the array of words using the enhanced for loop.
d. Write a method with the following signature:
public int count (HashMap<String, ArrayList<Integer>> map)
This method will return the total number of unique words in the lyric by analyzing the map.
e. Write a method with the following signature:
public String mostFrequentWord (HashMap<String, ArrayList<Integer>> map)
This method will return the word that occurs most frequently in the lyric. Do this by getting
a set of all the words in the map and then for each word, find the one that has the largest set
of word positions. Use the enhanced for loop in your solution. Do not create any
additional data structures to solve this problem. If there is a tie for the most frequent word,
print out the most frequent word that comes first alphabetically.