• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

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>







 
Our first order of business must be this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!