T
- The type of object stored in the buffer.public final class CyclicBuffer<T> extends Object
Constructor and Description |
---|
CyclicBuffer(Class<T> clazz,
int size)
Instantiates a new CyclicBuffer of at most
maxSize events. |
Modifier and Type | Method and Description |
---|---|
void |
add(T item)
Adds an item as the last event in the buffer.
|
boolean |
isEmpty()
Determines if the buffer contains elements.
|
T[] |
removeAll()
Removes all the elements from the buffer and returns them.
|
public CyclicBuffer(Class<T> clazz, int size) throws IllegalArgumentException
maxSize
events.clazz
- The Class associate with the type of object in the buffer.size
- The number of items in the buffer.IllegalArgumentException
- if the size is negative.public void add(T item)
item
- The item to add to the buffer.public T[] removeAll()
public boolean isEmpty()
Copyright © 1999-2017. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.