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.
Queueとして実装されているq1 があり、別の、しかし同一のq1の同一インスタンスである q2LinkedListを定義したいと考えています。QueueQueue
Queue
LinkedList
Queue実装していないので、どうすればいいCloneableですか?
Cloneable
ワンライナーで:
new LinkedList<>(myQueue);
Queue extends Collection、およびコレクションには、別の を受け取るコンストラクターがあるためCollection、これは浅いクローンを作成するための簡単な方法です。
Queue extends Collection
Collection
LinkedList必要に応じて、独自のQueue実装に置き換えてください。
また、javadocs もお読みください。彼らはすべての答えを持っています。