Exemplo n.º 1
0
 private void drawAux(String indent, StringBuilder builder) {
   builder.append(value);
   for (List<Node<T>> it = children; !it.isEmpty(); it = it.tail()) {
     final boolean isLast = it.tail().isEmpty();
     builder.append('\n').append(indent).append(isLast ? "└──" : "├──");
     it.head().drawAux(indent + (isLast ? "   " : "│  "), builder);
   }
 }
Exemplo n.º 2
0
 @Override
 public String draw() {
   StringBuilder builder = new StringBuilder();
   drawAux("", builder);
   return builder.toString();
 }