This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help reg collections utility

 
sathish gopal
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I definitely recommend learning about iterators. A great place to start is this section from Bruce Eckel's Thinking in Java.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would think that the add(int) method would offer very poor performance in getting values from a list.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic