Reputation: 97
If I have an ArrayList, I can swap two objects using Collections.swap(list, indexA, indexB).
Is there anything similar for an ArrayDeque?
Upvotes: 0
Views: 392
Reputation: 2504
No ArrayDequeue
is a Dequeue
implementation, which means it is meant to be used to insert and remove elements only at start and end of the collection. It does not provide indexed access to elements (unlike List
).
If you need indexed access to elements, and swap operation, you should reconsider your design and use another Collection type.
Upvotes: 3