Original Post
I suppose the question I have is two-fold, so I will number them for clarity:
1) Am I correct in assuming that the LinkedList class is more efficient than the Vector class?
2) When working with a List (whether it be ArrayList, LinkedList, etc...) is it better to use an Iterator object to traverse the list, or to use a loop and accessor methods?
The reason I ask is because I am working on a game that the GameObject class contains a list of Component objects. when the GameObject is updated, it traverses the list, calling the update method of each component. At the moment, I am using a LinkedList and traversing it by means of an Iterator object, but I am scared that bottlenecks can arise due to the nature of Iterators.
1) Am I correct in assuming that the LinkedList class is more efficient than the Vector class?
2) When working with a List (whether it be ArrayList, LinkedList, etc...) is it better to use an Iterator object to traverse the list, or to use a loop and accessor methods?
The reason I ask is because I am working on a game that the GameObject class contains a list of Component objects. when the GameObject is updated, it traverses the list, calling the update method of each component. At the moment, I am using a LinkedList and traversing it by means of an Iterator object, but I am scared that bottlenecks can arise due to the nature of Iterators.