I have a stream of elements. I want to map each element to two different elements of the same type so that my stream will be two times longer in consequence. I did this by concatenating two streams, but I'm wondering is it possible to do this simpler? What I've done so far:
private List<String> getTranslationFilesNames() {
return Stream.concat(SUPPORTED_LANGUAGES.stream()
.map(lang -> PATH_TO_FILES_WITH_TRANSLATIONS_1 + lang + FILE_EXTENSION),
SUPPORTED_LANGUAGES.stream()
.map(lang -> PATH_TO_FILES_WITH_TRANSLATIONS_2 + lang + FILE_EXTENSION))
.collect(Collectors.toList());
}
I don't find this solution very elegant. Is there better approach to achieve the same effect?