not necessarily related to its tree structureincluding the followingsize()return the number of nodes in the tree isempty()test whether the tree has any nodes or not iterator()return an iterator of all the elements stored at nodes of the tree positions()return an iterable collection of all the nodes of the tree replace( , )replace with and return the element stored at node any method that takes position as an argument should generate an error condition if that position is invalid we do not define any specialized update methods for trees here insteadwe prefer to describe different tree update methods in conjunction with specific applications of trees in subsequent in factwe can imagine several kinds of tree update operations beyond those given in this book implementing tree the java interface shown in code fragment represents the tree adt error conditions are handled as followseach method that can take position as an argumentmay throw an invalidpositionexceptionto indicate that the position is invalid method parent throws boundaryviolationexception if it is called on the root method root throws an emptytreeexception if it is called on an empty tree code fragment java interface tree representing the tree adt additional update methods may be addeddepending on the application we do not include such methods in the interfacehowever