Package org.assertj.core.presentation
Class BoundedQueue<T>
java.lang.Object
java.util.AbstractCollection<T>
java.util.AbstractQueue<T>
org.assertj.core.presentation.BoundedQueue<T>
- All Implemented Interfaces:
Iterable<T>
,Collection<T>
,Queue<T>
A queue with a fixed maximum size. Once the queue is full, no more elements can be added until an element is removed.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
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
Methods inherited from interface java.util.Collection
contains, containsAll, equals, hashCode, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray
-
Field Details
-
data
Queue that never holds more thancapacity
elements. -
capacity
private final int capacityThe maximum number of elements that can be present.
-
-
Constructor Details
-
BoundedQueue
BoundedQueue(int capacity) Creates a newBoundedQueue
.- Parameters:
capacity
- the maximum number of elements the queue can hold- Throws:
IllegalArgumentException
- if the capacity is negative
-
-
Method Details
-
iterator
- Specified by:
iterator
in interfaceCollection<T>
- Specified by:
iterator
in interfaceIterable<T>
- Specified by:
iterator
in classAbstractCollection<T>
-
size
public int size()- Specified by:
size
in interfaceCollection<T>
- Specified by:
size
in classAbstractCollection<T>
-
offer
-
poll
-
peek
-