What is the fastest way to convert a Queue into a List while keeping the Queue order?
What is the fastest way to convert a Queue into a List while keeping
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The fastest is to use a LinkedList in the first place which can be used as a List or a Queue.
Otherwise you need to take a copy
Note: When dealing with PriorityQueue, Use a loop, poll each element and add to list. PriorityQueue to List not maintaining the heap order.