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>

final class BoundedQueue<T> extends 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.
  • Field Details

    • data

      private final Queue<T> data
      Queue that never holds more than capacity elements.
    • capacity

      private final int capacity
      The maximum number of elements that can be present.
  • Constructor Details

    • BoundedQueue

      BoundedQueue(int capacity)
      Creates a new BoundedQueue.
      Parameters:
      capacity - the maximum number of elements the queue can hold
      Throws:
      IllegalArgumentException - if the capacity is negative
  • Method Details