Looking for a Good Data Structure
I need a container data structure that meets the following criteria.
1) Ordered by element insertion, first in first out
2) Two-way iteration
3) Iterator can be reset to point to the first element
4) Elements can be accessed individually via a unique ID
It seems like a LinkedHashMap would work well, except for the fact that it will only return a plain Iterator from the values() method, and that only works for one-way iteration, not to mention that (as far as I know) the Iterator can't be reset to point to the first element.
Any suggestions? I'd like to try to keep this relatively simple. No need to reinvent the wheel, eh? ;)
1) Ordered by element insertion, first in first out
2) Two-way iteration
3) Iterator can be reset to point to the first element
4) Elements can be accessed individually via a unique ID
It seems like a LinkedHashMap would work well, except for the fact that it will only return a plain Iterator from the values() method, and that only works for one-way iteration, not to mention that (as far as I know) the Iterator can't be reset to point to the first element.
Any suggestions? I'd like to try to keep this relatively simple. No need to reinvent the wheel, eh? ;)
