Special kind of queue

Posted by devoured elysium on Stack Overflow See other posts from Stack Overflow or by devoured elysium
Published on 2010-03-21T18:19:17Z Indexed on 2010/03/21 18:21 UTC
Read the original article Hit count: 348

Filed under:
|
|

I am looking for something like a Queue that would allow me to put elements at the end of the queue and pop them out in the beggining, like a regular Queue does.

The difference would be that I also need to compact the Queue from time to time. This is, let's assume I have the following items on my Queue (each character, including the dot, is an item in the Queue):

e d . c . b . a
(this Queue has 8 items)

Then, I'd need for example to remove the last dot, so to get:

e d . c . b a

Is there anything like that in the Java Collection classes? I need to use this for a program I am doing where I can't use anything but Java's classes. I am not allowed to design one for myself. Currently I'm just using a LinkedList, but I thought maybe this would be more like a Queue than a LinkedList.

Thanks

© Stack Overflow or respective owner

Related posts about java

Related posts about queue