示例#1
0
 public ArrayList<Object> toArrayList(ArrayList<Object> list) {
   if (left == null && right == null) {
     list.add(this);
     return list;
   }
   list.add(this);
   if (left != null) {
     left.toArrayList(list);
   }
   if (right != null) {
     right.toArrayList(list);
   }
   return list;
 }
示例#2
0
 public ArrayList<Object> toArrayList() {
   ArrayList<Object> list = new ArrayList<Object>();
   if (root == null) {
     return list;
   }
   return root.toArrayList(list);
 }