| Author |
ListIterator
|
R Jarman
Greenhorn
Joined: Feb 08, 2005
Posts: 27
|
|
|
I'm using a ListIterator to parse through an ArrayList. I understand how to use it to parse the entire array but what if I'm looking for something in the array? Once I find the object I want to do some processing on it and I don't want to parse the rest of the array. How can I punch out of an ListIterator once a condition has been met or am I better off using the old way with for loops or while loops?
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24081
|
|
|
Just don't call "next" anymore. Use "break" to escape out of your loop.
|
[Jess in Action][AskingGoodQuestions]
|
 |
 |
|
|
subject: ListIterator
|
|
|