Algorithme pour afficher un arbre
2013-08-16
Voici un algorithme pour afficher un joli arbre à la manière de la commande tree. private void print(Writer out, String prefix, List<Object> items) throws IOException { int j; for (j=items.size()-1; j>=0; j--) { Object o = items.get(j); if (! (o instanceof List)) break; } for (int i=0; i<items.size(); i++) { Object o = items.get(i); boolean isTail = (i >= j) || (i == items.size() - 1); if (! (o instanceof List)) { out.