T
- the contained element typepublic class CircularBuffer<T>
extends java.lang.Object
Constructor and Description |
---|
CircularBuffer(int size)
Construct a new circular buffer.
|
public CircularBuffer(int size)
size
- the buffer sizepublic void add(T value)
value
- the valuepublic T get(int index)
index
- the absolute indexpublic T take()
public boolean isEmpty()
public int size()
public int head()
public int tail()