@Test public void testExtraSpaces() { AnalysisResult result = analyse(LINE_WITH_SPACES); validate(result, use(WORD_1, 1, LineReference.FIRST), use(WORD_3, 1, LineReference.FIRST), use(WORD_2, 1, LineReference.FIRST)); }
@Override public AnalysisResult analyse(final String text, final String name) { List<String> lines = splitToList(text); Map<String, WordUse> map = IntStream.range(0, lines.size()) .parallel() .boxed() .flatMap(i -> lineRecords(lines, i)) .collect(groupingBy(AnalysisRecord::getNormalised, new AnalysisCollector())); List<WordUse> uses = map.values().stream() .sorted(WordStreamTool.WORD_COMPARATOR) .collect(toList()); return new AnalysisResult(name, uses, lines); }
SimpleAnalyser implements Analyser { @Override public AnalysisResult analyse(final String text, final String name) { List<String> lines = splitToList(text); Map<String, WordUse> map = IntStream.range(0, lines.size()) .parallel() .boxed() .flatMap(i -> lineRecords(lines, i)) .collect(groupingBy(AnalysisRecord::getNormalised, new AnalysisCollector())); List<WordUse> uses = map.values().stream() .sorted(WordStreamTool.WORD_COMPARATOR) .collect(toList()); return new AnalysisResult(name, uses, lines); } }
SimpleAnalyser implements Analyser { @Override public AnalysisResult analyse(final String text, final String name) { List<String> lines = splitToList(text); Map<String, WordUse> map = IntStream.range(0, lines.size()) .parallel() .boxed() .flatMap(i -> lineRecords(lines, i)) .collect(groupingBy(AnalysisRecord::getNormalised, new AnalysisCollector())); List<WordUse> uses = map.values().stream() .sorted(WordStreamTool.WORD_COMPARATOR) .collect(toList()); return new AnalysisResult(name, uses, lines); }  }
SimpleAnalyser implements Analyser { @Override public AnalysisResult analyse(final String text, final String name) { List<String> lines = splitToList(text); Map<String, WordUse> map = IntStream.range(0, lines.size()) .parallel() .boxed() .flatMap(i -> lineRecords(lines, i)) .collect(groupingBy(AnalysisRecord::getNormalised, new AnalysisCollector())); List<WordUse> uses = map.values().stream() .sorted(WordStreamTool.WORD_COMPARATOR) .collect(toList()); return new AnalysisResult(name, uses, lines); }  @Override AnalysisResult analyse(final String text, final String name); }
SimpleAnalyser implements Analyser { @Override public AnalysisResult analyse(final String text, final String name) { List<String> lines = splitToList(text); Map<String, WordUse> map = IntStream.range(0, lines.size()) .parallel() .boxed() .flatMap(i -> lineRecords(lines, i)) .collect(groupingBy(AnalysisRecord::getNormalised, new AnalysisCollector())); List<WordUse> uses = map.values().stream() .sorted(WordStreamTool.WORD_COMPARATOR) .collect(toList()); return new AnalysisResult(name, uses, lines); }  @Override AnalysisResult analyse(final String text, final String name);  }