Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我有一个 ArrayList,我可以使用 Collections.swap(list, indexA, indexB) 交换两个对象。
ArrayDeque 有类似的东西吗?
NoArrayDequeue是一种Dequeue实现,这意味着它仅用于在集合的开头和结尾插入和删除元素。它不提供对元素的索引访问(与 不同List)。
ArrayDequeue
Dequeue
List
如果您需要对元素进行索引访问和交换操作,您应该重新考虑您的设计并使用另一种 Collection 类型。