T
- The type of elements collected.public class BoundedFIFOQueue<T> extends Object implements Iterable<T>, Serializable
BoundedFIFOQueue
collects elements up to given amount. Reaching this limit will result in
removing the oldest element from this queue (First-In/First-Out; FIFO).Constructor and Description |
---|
BoundedFIFOQueue(int maxSize)
Creates a
BoundedFIFOQueue with the given maximum size. |
Modifier and Type | Method and Description |
---|---|
void |
add(T element)
Adds an element to the end of the queue.
|
Iterator<T> |
iterator()
Returns the
BoundedFIFOQueue 's Iterator . |
int |
size()
Returns the number of currently stored elements.
|
ArrayList<T> |
toArrayList() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public BoundedFIFOQueue(int maxSize)
BoundedFIFOQueue
with the given maximum size.maxSize
- The maximum size of this queue. Exceeding this limit would result in removing
the oldest element (FIFO).IllegalArgumentException
- If maxSize
is less than 0.public void add(T element)
element
- The element that should be added to the end of the queue.NullPointerException
- If null
is passed as an element.public int size()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.