Been finding it hard to get anywhere with these questions wandering if anybody could help me out a little bit. Any help would be much appreciated.


You are provided with a List<String> of words. Each word in the list can occur more than once.

a) Write the method
String findWord(List<String> words, String s)

which returns true if s is in the list or false otherwise. For full marks the method should ignore the case, so that sNAke = snake for example. [3 marks] [easy]


b) Write the method
String findLastWord(List<String> words)

which returns the word that appears last, if sorted alphabetically. Remember Collections.Sort(.....) will sort a list. [3 marks] [easy]


c) Write the method
int getAverageLength (List<String> words)

which returns the average length of all the words in the list. For example, if the list contained {the, cat, snake, zebra} the answer would be 4. For full marks you must round the average to the nearest character. [6 marks] [moderate]


d) Write the method
String findMostCommonWord(List<String> words)

which returns the word that appears most often in the list. For full marks it should ignore case, so SnAKE and snake and SNAKE all count as the same word. [8 marks] [moderate]


e) Write the method
ArrayList<String> sortByLength(List<String> words)

which returns an arraylist of the words in the original list, but sorted by length from lowest to highest.

For example - if the list was {dog, tree, cake, beggar, cheese, a}

the resulting arraylist would be {a, dog, tree, cake, cheese, beggar}

If two words have the same number of letters, just place them next to each other in the list as shown above.
[15 marks] [difficult