Amazon { public List<String> retrieveMostFrequentlyUsedWords(String literatureText, List<String> wordsToExclude) { Set<String> setToExcluded = new HashSet<>(); for (String excluded : wordsToExclude) { if (excluded != null) { setToExcluded.add(excluded.trim().toLowerCase()); } } Map<String, Integer> wordsMap = new HashMap<>(); String[] words = literatureText.split("[[^a-z]&&[^A-Z]]"); for (String word : words) { String low = word.toLowerCase(); System.out.println(low); if (!setToExcluded.contains(low)) { wordsMap.put(low, wordsMap.getOrDefault(low, 0) + 1); } } List<String> mostFrequent = new ArrayList<>(); int toppest = 0; for (int frequency : wordsMap.values()) { toppest = Math.max(toppest, frequency); } for (Map.Entry<String, Integer> entry : wordsMap.entrySet()) { if (entry.getValue() == toppest) { mostFrequent.add(entry.getKey()); } } Collections.sort(mostFrequent); return mostFrequent; }  List<String> retrieveMostFrequentlyUsedWords(String literatureText,
                                                        List<String> wordsToExclude); List<String> reorderLines(int logFileSize, List<String> logLines);  }
@Test(dataProvider = "rmfu") public void testRMFU(String literatureText, List<String> wordsToExclude, List<String> expected) { Amazon s = new Amazon(); assertEquals(expected, s.retrieveMostFrequentlyUsedWords(literatureText, wordsToExclude)); }