Im trying to add each node of a Binary Search Tree to an ArrayList in order, I currently have this code...
private ArrayList<String> toArray(TreeNode<Comparable> root)
{
ArrayList<String> array = new ArrayList<String>();
if(root!= null)
return null;
inorder(root.getLeft());
array.add(root.getValue());
inorder(root.getRight());
return array;
}
but i get this error from running it...
Error: BSTree.java:64: cannot find symbol
symbol : method add(java.lang.Comparable)
location: class java.util.ArrayList<java.lang.String>
thank you for any help.