This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Vijayakumar Rengaraj wrote:The content of the collection will not change with respect to the retrieval, You can get the elements of the collection based on the position(in case of List) any any time.
Arent Stacks and Queues also collections? In that case it's requestet that the contents change (push/pop etc.).
As for the original question: I don't understand what you're asking. You have a collection with ten objects in it, and then some randomly numbers ... how do they fit in there? Can you phrase the question again?
Censorship is the younger of two shameful sisters, the older one bears the name inquisition. -- Johann Nepomuk Nestroy
@Peter: If the numbers were retrieved randomly, odds are it isn't a stack or queue.
@Venu: It depends on how you're retrieving them: if you're removing them as you retrieve them, it's easy. Otherwise you'd need to keep track of which numbers you've retrieved, like by removing them from a map, or using a bitmap, or toggling a flag, or... etc. There would be quite a few ways of implementing this.