public WordList build() {
            if (wordList.isEmpty()) {
                return EMPTY;
            } else {
                final List<Word> wordObjList = new ArrayList<>(wordList.size());
                for (final SourcedWord sourcedWord : wordList) {
                    final String word = sourcedWord.word;
                    final String sourceUuid = sourcedWord.sourceUuid;

                    List<String> additionalSources = null;
                    final List<String> allSources = NullSafe.list(wordToSourceUuidsMap.get(word));
                    if (deDup) {
                        // First one is the primary source, so ignore it
                        if (allSources.size() > 1) {
                            additionalSources = allSources.subList(1, allSources.size());
                        }
                    } else {
                        // Not de-duping so get all sources except ours
                        additionalSources = allSources.stream()
                                .filter(uuid -> !Objects.equals(sourceUuid, uuid))
                                .collect(Collectors.toList());
                    }
                    final Word wordObj = new Word(word, sourceUuid, additionalSources);
                    wordObjList.add(wordObj);
                }
                return new WordList(wordObjList, sourceUuidToDocRefMap);
            }
        }
@return The complete word list as a simple array or words.
stroom-core-shared/src/main/java/stroom/dictionary/shared/WordList.java