• Post Reply Bookmark Topic Watch Topic
  • New Topic

which class implements ListIterator  RSS feed

 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
who needs to implement ListIterator ?programmer? or any inbilt java class?
i've refered to java API but there i havn't found any class implementing this interface

if possible ,can any one provide me nice implementation for this interface
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jakarta's commons Collections implements it : ListIteratorWrapper
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you need someone to implement this for you? What kind of list should it iterate over? Do you have some particular project in mind where you need this?

The existence of this class is primarily useful along with the List interface. Notice that it has methods that return ListIterator. If you call any of these methods, you don't have to worry about who the concrete class is that implements this interface. You only need to know that this class certainly implements all the methods required by the ListIterator documentation.

So in the end, if you are using the standard Collections API, you don't need to worry about writing your own class to implement this interface. One exists already. However, if you are writing your own class to implement the List interface, then you probably need to create a companion class that implements ListIterator as well. I don't think someone will just do this for you.

Layne
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saikrishna --

In the Java Collections API, there are some methods that are declared to return an Iterator, and other that return a ListIterator. Without exception (at least, without exception that comes to mind) these methods return an instance of a private inner class of the Collection they're invoked on. Because an inner class has special access to the data of its outer class, they are ideally suited for implementing fast and efficient Iterators and ListIterators.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!