ListOfOrderedSentencesGenerator { public List<T> getSortedSentences() { Map<T, Double> sentenceNetWeights = new HashMap<>(); Map<T, Double> sentenceSpans = getSentenceSpans(); for (Map.Entry<T, Double> entry : sentenceSpans.entrySet()) { T sentence = entry.getKey(); Double span = entry.getValue(); Collection<String> wordsInSentence = sentenceToWordsStringMap.get(sentence); double sumOfWordFrequenciesInSentence = 0.0; for (String word : wordsInSentence) { int frequencyOfWord = wordFrequencies.get(word); sumOfWordFrequenciesInSentence += frequencyOfWord; } Double netWeight = sumOfWordFrequenciesInSentence * span; sentenceNetWeights.put(sentence, netWeight); } return sentenceNetWeights.entrySet().stream() .sorted(Map.Entry.<T, Double>comparingByValue().reversed()) .map(Entry::getKey) .collect(Collectors.toCollection(LinkedList::new)); } ListOfOrderedSentencesGenerator(
      Map<T, List<String>> sentenceToWordsStringMap,
      Map<String, Integer> wordFrequencies,
      int numberOfWordsAboveThreshold); List<T> getSortedSentences(); Map<String, Integer> adjustWordFrequencies(String topWeightedSentence);  }
@Test public void testGetSentenceNetWeights() { List<String> sortedSentences = listOfOrderedSentencesGenerator.getSortedSentences(); assertEquals("First sorted sentence should be SENTENCE_1", SENTENCE_1, sortedSentences.get(0)); assertEquals( "Last sorted sentence should be SENTENCE_3", SENTENCE_3, sortedSentences.get(sortedSentences.size() - 1)); }