@Test public void writeTreeWithOneChildAndNodeConverter() throws IOException { Tree<String> tree = new Tree<>("root"); tree.addChild("child"); StringWriter writer = new StringWriter(); tree.write(new PrintWriter(writer), node -> "my " + node.getValue()); BufferedReader reader = new BufferedReader(new StringReader(writer.getBuffer().toString())); assertEquals("my root" , reader.readLine()); assertEquals("+- my child" , reader.readLine()); }
public void write(PrintStream stream) { write(new PrintWriter(stream)); }
Tree extends Node<T> { public void write(PrintStream stream) { write(new PrintWriter(stream)); } }
Tree extends Node<T> { public void write(PrintStream stream) { write(new PrintWriter(stream)); } Tree(T root); }
Tree extends Node<T> { public void write(PrintStream stream) { write(new PrintWriter(stream)); } Tree(T root); void write(PrintStream stream); void write(PrintStream stream, Converter<T> converter); void write(PrintWriter writer); void write(PrintWriter writer, Converter<T> converter); }
Tree extends Node<T> { public void write(PrintStream stream) { write(new PrintWriter(stream)); } Tree(T root); void write(PrintStream stream); void write(PrintStream stream, Converter<T> converter); void write(PrintWriter writer); void write(PrintWriter writer, Converter<T> converter);  }