In reply to javatea:
Depending on the question, I am not sure what did he want. If he wants to get unique elements from a queue, he may use your way. But if he wants to delete a element which occurs many positions (duplicate) in that queue, he can use my way.