I'm helping my friend with his code and he has a separate class setup for Illegal Arguments.
Am I right in thinking that these lines of code makes sure that when the tree is empty and illegal exception is not thrown for the root, left, right.
public T root() {
throw new IllegalArgumentException("Can't do root of empty bst <T>");
}
public AbstractBST<T> left() {
throw new IllegalArgumentException("Can't do left of empty bst <T>");
}
public AbstractBST<T> right() {
throw new IllegalArgumentException("Can't do right of empty bst <T>");
}
public boolean isEmpty() {
return true;
This post has been edited by zanyrogue: 20 March 2010 - 09:42 AM

New Topic/Question
Reply


MultiQuote




|