Now is time to code. We have saw which methods of BinaryTree and his internal structure. I am going to show you the variables needed to implement and explain how works.
//Nodo is an internal class which we know as node.
//The root of the BinaryTree
private Nodo root = null;
// Is a counter of elements (nodes)
private int elementCount = 0;
// Is a counter of modifications made on the BinaryTree structure, (remove,add,setRoot and clear)
// Is necesary beacuse the iterator has to check the modifications made at the same time we walk the BinaryTree.
private int modCount = 0;
I must remember to you i am spanish and the commentaries of the sourcecode are on my own language. But you will not have any problem because the most important methods are in English.