• Post Reply Bookmark Topic Watch Topic
  • New Topic

Implement methods for Iterator using Generics for TreeSet  RSS feed

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I am very new to Generics and try to get hold of it.. I am having a small assignent for Adding two methods boolean remove(E obj): and Iterator<E> iterator( ):
in the class given below...


boolean remove(E obj): Remove a piece of data from the binary search tree. Return true if the data was removed, or false if it was not in the tree to begin with. Follow the algorithm involving removing items from binary search trees.

Iterator<E> iterator( ): Return an Iterator that can iterate through the data in the tree. The iteration should be an "in-order" iteration (i.e., ascending order). Recall that iterators have the following methods:
boolean hasNext( )
T next( )
void remove( )


It does additional to the list correctly.

I just want it to return Iterator<E> ... since It looked for the implementation for these methods and found that the implementation of these method is given by in

abstract class AbstractList<E>







 
Always look on the bright side of life. At least this ad is really tiny:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!