Class RingQueue<E>
- java.lang.Object
 - 
- java.util.AbstractCollection<E>
 - 
- java.util.AbstractQueue<E>
 - 
- org.apache.qpid.protonj2.engine.util.RingQueue<E>
 
 
 
 
- 
- Type Parameters:
 E- the element type that is stored in thisQueuetype.
- All Implemented Interfaces:
 java.lang.Iterable<E>,java.util.Collection<E>,java.util.Queue<E>
public class RingQueue<E> extends java.util.AbstractQueue<E>Simple Ring Queue implementation that has an enforced max size value. 
- 
- 
Constructor Summary
Constructors Constructor Description RingQueue(int queueSize)Creates a newRingQueueinstance with the given fixed Queue size.RingQueue(java.util.Collection<E> collection)Creates a newRingQueueinstance with a size that matches the size of the givenCollectionand filled with the values from thatCollection. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddAll(java.util.Collection<? extends E> c)voidclear()booleancontains(java.lang.Object value)booleanisEmpty()java.util.Iterator<E>iterator()booleanoffer(E e)Epeek()Epoll()Epoll(java.util.function.Supplier<E> createOnEmpty)Retrieves and removes the head of this ring queue, and if the queue is currently empty a new instance of the queue type is provided by invoking the givenSupplier.booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection<?> c)booleanretainAll(java.util.Collection<?> c)intsize()- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
RingQueue
public RingQueue(int queueSize)
Creates a newRingQueueinstance with the given fixed Queue size.- Parameters:
 queueSize- The size to use for the ring queue.
 
 - 
 
- 
Method Detail
- 
offer
public boolean offer(E e)
 
- 
poll
public E poll()
 
- 
poll
public E poll(java.util.function.Supplier<E> createOnEmpty)
Retrieves and removes the head of this ring queue, and if the queue is currently empty a new instance of the queue type is provided by invoking the givenSupplier.- Parameters:
 createOnEmpty- aSupplierwhich will return default values if theRingQueueis empty.- Returns:
 - the head element of this queue or a default instance created from the provided 
Supplier/ 
 
- 
peek
public E peek()
 
- 
addAll
public boolean addAll(java.util.Collection<? extends E> c)
 
- 
remove
public boolean remove(java.lang.Object o)
 
- 
removeAll
public boolean removeAll(java.util.Collection<?> c)
 
- 
retainAll
public boolean retainAll(java.util.Collection<?> c)
 
- 
iterator
public java.util.Iterator<E> iterator()
 
- 
size
public int size()
 
- 
isEmpty
public boolean isEmpty()
 
- 
clear
public void clear()
 
 - 
 
 -