You're using the raw Comparable
type, instead of using the generic Comparable<Tree>
type. To compile, as is, your compareTo() method should thus take an Object as argument, and not a Tree. But of course, the correct way to fix it is to make your class implement Comparable<Tree>
.
Also, note that instead of creating two new Integer instances at each comparison, you could simply use (since Java 7):
return Integer.compare(this.root.iData, arg0.root.iData);