at.molindo.utils.collections
Class CircularQueue<T>
java.lang.Object
java.util.AbstractCollection<T>
at.molindo.utils.collections.CircularQueue<T>
- All Implemented Interfaces:
- Iterable<T>, Collection<T>, Queue<T>
public class CircularQueue<T>
- extends AbstractCollection<T>
- implements Queue<T>
Queue implementation that uses a single, fixed-size buffer as if it
were connected end-to-end. This structure lends itself easily to buffering
data streams.
|
Constructor Summary |
CircularQueue(int capacity)
create a new queue with the given capacity |
CircularQueue
public CircularQueue(int capacity)
- create a new queue with the given capacity
offer
public boolean offer(T e)
- Specified by:
offer in interface Queue<T>
add
public boolean add(T e)
- overrides first element in queue if queue is full
- Specified by:
add in interface Collection<T>- Specified by:
add in interface Queue<T>- Overrides:
add in class AbstractCollection<T>
- See Also:
Queue.add(Object)
onOverflow
protected void onOverflow()
remove
public T remove()
- Specified by:
remove in interface Queue<T>
poll
public T poll()
- Specified by:
poll in interface Queue<T>
element
public T element()
- Specified by:
element in interface Queue<T>
peek
public T peek()
- Specified by:
peek in interface Queue<T>
size
public int size()
- Specified by:
size in interface Collection<T>- Specified by:
size in class AbstractCollection<T>
isFull
public boolean isFull()
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface Collection<T>- Overrides:
isEmpty in class AbstractCollection<T>
iterator
public Iterator<T> iterator()
- Specified by:
iterator in interface Iterable<T>- Specified by:
iterator in interface Collection<T>- Specified by:
iterator in class AbstractCollection<T>
clear
public void clear()
- Specified by:
clear in interface Collection<T>- Overrides:
clear in class AbstractCollection<T>
remove
public boolean remove(Object o)
- Specified by:
remove in interface Collection<T>- Overrides:
remove in class AbstractCollection<T>
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll in interface Collection<T>- Overrides:
removeAll in class AbstractCollection<T>
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll in interface Collection<T>- Overrides:
retainAll in class AbstractCollection<T>
Copyright © 2013 Molindo GmbH. All Rights Reserved.