public Tree < T > build ( ) { Tree < T > result = base ; if ( null == base && treeStack . size ( ) == 1 ) { result = treeStack . get ( 0 ) ; } else if ( treeStack . size ( ) > 0 ) { result = new TreeStack < T > ( treeStack , base ) ; } else if ( null == base ) { throw new IllegalArgumentException ( "base tree was not set" ) ; } return result ; }
Build the tree