aspose file tools*
The moose likes Beginning Java and the fly likes help reg collections utility Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "help reg collections utility" Watch "help reg collections utility" New topic
Author

help reg collections utility

sathish gopal
Greenhorn

Joined: Dec 30, 2000
Posts: 21
I have list object. i want to get all the elements from them.
i used a method add(int index) to get all the elements from them.
When i carefully looked at the API there is Interface called Iterator which can also be used to get elements out from the list.
Which is the best and efficient way..
I am using JDK 1.4.2
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

I definitely recommend learning about iterators. A great place to start is this section from Bruce Eckel's Thinking in Java.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
I would think that the add(int) method would offer very poor performance in getting values from a list.


"I'm not back." - Bill Harding, Twister
 
jQuery in Action, 2nd edition
 
subject: help reg collections utility