public class RingBuffer<E> extends Object
| Constructor and Description |
|---|
RingBuffer(int maxSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(E e)
Add an element to the buffer, replacing the oldest element in the buffer if full.
|
void |
clear()
Clear the contents of this buffer.
|
E |
get(int index)
Get the element at the specified index.
|
boolean |
isEmpty() |
int |
maxSize() |
E |
remove() |
void |
set(int index,
E e)
Set the element at the specified index.
|
int |
size() |
public E get(int index)
index - The specified index.IndexOutOfBoundsException - if the index is out of bounds...public void set(int index,
E e)
index - The specified index.e - The element to set.IndexOutOfBoundsException - if the index is out of bounds...public void add(E e)
e - element to add.public E remove()
NoSuchElementException - if the buffer is empty.public void clear()
public boolean isEmpty()
true if the buffer is empty (size == 0).public int maxSize()
public int size()
Copyright © 2018. All rights reserved.