public class CyclicBufferList extends AbstractList implements List
modCount
Constructor and Description |
---|
CyclicBufferList() |
CyclicBufferList(int maxSize)
Instantiate a new CyclicBuffer of at most
maxSize events. |
Modifier and Type | Method and Description |
---|---|
boolean |
add(Object event)
Add an
event as the last event in the buffer. |
void |
clear() |
Object |
get()
Get the oldest (first) element in the buffer.
|
Object |
get(int i)
Get the ith oldest event currently in the buffer.
|
int |
getLast() |
int |
getMaxSize() |
Object |
remove(int index)
Removes the element at the specified position in this list.
|
void |
resize(int newSize)
Resize the cyclic buffer to
newSize . |
Object |
set(int index,
Object element) |
int |
size()
Get the number of elements in the buffer.
|
add, addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, addAll, addAll, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, replaceAll, retainAll, sort, spliterator, subList, toArray, toArray
parallelStream, removeIf, stream
public CyclicBufferList(int maxSize)
maxSize
events.
The maxSize
argument must a positive integer.maxSize
- The maximum number of elements in the buffer.public CyclicBufferList()
public Object remove(int index)
remove
in interface List
remove
in class AbstractList
index
- the index of the element to removed.IndexOutOfBoundsException
- if index out of range (index
< 0 || index >= size()).public Object set(int index, Object element)
set
in interface List
set
in class AbstractList
public boolean add(Object event)
event
as the last event in the buffer.add
in interface Collection
add
in interface List
add
in class AbstractList
public Object get(int i)
null
is returned.get
in interface List
get
in class AbstractList
public int getMaxSize()
public int getLast()
public Object get()
public int size()
maxSize
(inclusive).size
in interface Collection
size
in interface List
size
in class AbstractCollection
public void resize(int newSize)
newSize
.IllegalArgumentException
- if newSize
is negative.public void clear()
clear
in interface Collection
clear
in interface List
clear
in class AbstractList
Copyright © 2002-2018 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache Chainsaw, Chainsaw, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.