Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to remove a random element from a queue?

843789Apr 24 2009 — edited Apr 25 2009
Hi,
I am new to Java programming...Please help me with this :

I have created an object of Queue class in java..Now i wanna remove any random element from the queue by iterating through all its elements...I was unable to find any q.next() method in the documentation and i am not sure whether it is possible to remove any random positioned element from the queue or its just the first element that would be deleted every time?

How can i remove a random positioned element in a queue object?
Please help me out..
Thanks !
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 23 2009
Added on Apr 24 2009
14 comments
1,412 views