Isn't this similar to the buffer interface?

Stephen

Is there any interest in adding some Queue classes to commons collections?
The following is what i have so far:

public interface Queue extends Collection {
    Object remove();
    Object get();
    Object get(int index);
    Object remove(int index);
    int indexOf(Object object);}
}

public interface BoundedQueue extends Queue, BoundedCollection {
}

I have also provided the following implementation classes:

/*** A LIFO queue whose remove() method removes the most recently
      added item in the queue ***/
public class LifoQueue extends AbstractQueue { }

/*** A FIFO queue whose remove() method removes the least recently
      added item in the queue ***/
public class FifoQueue extends AbstractQueue { }


/*** Decorates a Queue to enforces "Set" semantics, so you cannot have the same element in the queue twice (at the same time). It can either use the .equals method, or a comparator for object comparison ***/ public class UniqueQueue implements Queue { public UniqueQueue(Queue queue); public UniqueQueue(Queue queue, Comparator comparator); }

/*** Decorates a queue so that if you try to add an item to a Queue
      that has reached it's maximum size, it will remove an element
from
      the queue (uses the remove() method on the Queue interface, so
as
      to abide by the LIFO, FIFO, LRU semantics on the underlying
queue) ***/
public class RemovingBoundedQueue
    extends AbstractBoundedQueue
    implements BoundedQueue {

    public RemovingBoundedQueue(int maxSize, Queue queue);
}

And the following utility class:

public class Queues {
     public static Queue synchronizedQueue(Queue queue);
     public static BoundedQueue
synchronizedBoundedQueue(BoundedQueue queue);
}


The BoundedQueue in and of itself is nice for history lists, where you want
to maintain
a certain amount of history, and throw anything beyond that away (which was
the purpose
of creating these classes anyway was to create a way for a text box to have
history,
by having changing it to a combo box, and hooking in the combo box model to
a Bounded
FIFO queue).


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to