Package org.assertj.core.presentation
Class BoundedQueue<T>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<T>
-
- org.assertj.core.presentation.BoundedQueue<T>
-
- All Implemented Interfaces:
java.lang.Iterable<T>,java.util.Collection<T>,java.util.Queue<T>
final class BoundedQueue<T> extends java.util.AbstractQueue<T>A queue with a fixed maximum size. Once the queue is full, no more elements can be added until an element is removed.
-
-
Constructor Summary
Constructors Constructor Description BoundedQueue(int capacity)Creates a newBoundedQueue.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Iterator<T>iterator()booleanoffer(T element)Tpeek()Tpoll()intsize()-
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
data
private final java.util.Queue<T> data
Queue that never holds more thancapacityelements.
-
capacity
private final int capacity
The maximum number of elements that can be present.
-
-
Constructor Detail
-
BoundedQueue
BoundedQueue(int capacity)
Creates a newBoundedQueue.- Parameters:
capacity- the maximum number of elements the queue can hold- Throws:
java.lang.IllegalArgumentException- if the capacity is negative
-
-