Код: Выделить всё
public void writeDot() {
try (PrintStream out = new PrintStream(path, "UTF-8")) {
out.print("digraph {\n");
String[] arr = {"hyo", "ji", "yoo", "mi", "vi", "se", "ari"};
combination(arr, 2, 0, new String[2])
.stream()
.map(a -> Arrays.toString(a).join(" -> "))
.forEach(out::print);
out.println(";\n");
out.println("}");
} catch (IOException ioException) {
ioException.printStackTrace();
}
}
< /code>
Метод комбинации выглядит так: < /p>
public List combination(String[] arr, int len, int startPosition, String[] result) {
if (len == 0) {
//System.out.println(Arrays.toString(result));
return null;
}
for (int i = startPosition; i
Результат я ожидал: < /p>
digraph {
hyo -> ji;
ji -> hyo;
and so on..
}
< /code>
Но я получаю только: < /p>
digraph {
;
}
Подробнее здесь: https://stackoverflow.com/questions/637 ... ava-stream