why not just use Queue.poll() and not copy it to the ArrayList ? This way you not need to copy and clear it