List<String> () { // at first add dependencies ArrayList<String> entries = myDependencies.stream() .flatMap(dependency -> dependency.getPythonPathEntries().stream()) .collect(Collectors.toCollection(ArrayList::new)); // then add helper script entries.add(getPythonPathEntry()); return entries; }