I'm a relatively new Java programmer coming from C++/STL, and am looking for a class with these characteristics (which the C++ std::deque has, as I understand it):
- O(1) performance for insertion/removal at the beginning/end
- O(1) performance for lookup by index
- are growable collections (don't need fixed size bounds)
Is there a Java equivalent to this? I found the Java 1.6 [ArrayDeque] class which has the insert/removal and growable characteristics, but don't seem to have lookup-by-index unless you call toArray() which would not be O(1).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…