aspose file tools
The moose likes Beginning Java and the fly likes Iterator's add Method() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Iterator Watch "Iterator New topic
Author

Iterator's add Method()

Nelson Nadal
Ranch Hand

Joined: Jun 06, 2002
Posts: 169
Is there really add() method for Iterator? The api docs said under Vector...
"
The Iterators returned by Vector's iterator and listIterator methods are fail-fast: if the Vector is structurally modified at any time after the Iterator is created, in any way except through the Iterator's own remove or add methods, the Iterator will throw a ConcurrentModificationException. "
But I found nothing add() under Iterator...
Stu Glassman
Ranch Hand

Joined: Jul 01, 2002
Posts: 91
Vector extends the AbstractList class. AbstractList has a method named listIterator(), which returns a ListIterator. ListIterator contains those add and remove methods that you're looking for.
Hope this helps,
-Stu
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
You might want to check my series on Collections in the JavaRanch newsletter.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Iterator's add Method()
 
Similar Threads
Synchronized data structure question
Multiple thread accessing List (ArrayList, Vector)
Iterators from Vector are fail-safe?
Looking through collections
An Iterator throws a ConcurrentModificationException