public class RingBuffer<T> extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CAPACITY |
Constructor and Description |
---|
RingBuffer() |
RingBuffer(int capacity) |
Modifier and Type | Method and Description |
---|---|
void |
addItem(T item)
add new item in the ring buffer
|
void |
clear()
Clears the RingBuffer by resetting the variable pointer and nUpdates to its
initial value.
|
List<T> |
getAsList()
Get all current ring's contents
|
int |
getCapacity()
Get buffer's capacity
|
int |
getNumberOfUpdates()
Get number of buffer updates
(returned Long.MAX_VALUE means that it was updated
more than Long.MAX_VALUE times)
|
String |
toString()
string representation of ring buffer
|
String |
toString(int nItems)
string representation of the
part of a ring buffer
|
public static final int DEFAULT_CAPACITY
public final void addItem(T item)
item
- to addpublic final int getCapacity()
public final int getNumberOfUpdates()
public String toString()
public String toString(int nItems)
how
- many items of a ring buffer
to representpublic final void clear()
Copyright © 2008, 2017, Oracle. All rights reserved.