public class RingBuffer<T> extends AbstractList<T>
Modifier and Type | Class and Description |
---|---|
protected class |
RingBuffer.RingBufferIterator |
protected class |
RingBuffer.RingBufferListIterator |
Modifier and Type | Field and Description |
---|---|
protected T[] |
buffer |
protected static IllegalStateException |
illegalStateException |
protected static IndexOutOfBoundsException |
indexOutOfBoundsException |
protected int |
nextBufferIndex |
protected int |
nextRealIndex |
protected static NoSuchElementException |
noSuchElementException |
protected int |
size |
modCount
Constructor and Description |
---|
RingBuffer(int capacity) |
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
T element) |
boolean |
add(T element) |
void |
clear() |
boolean |
containsIndex(int index) |
T |
get(int index) |
protected boolean |
indexOutOfBounds(int index) |
Iterator<T> |
iterator() |
int |
lastIndex() |
ListIterator<T> |
listIterator() |
ListIterator<T> |
listIterator(int index) |
int |
nextIndex() |
T |
remove(int index) |
protected T |
removeUnsafe(int index) |
int |
size() |
T[] |
toArray() |
addAll, equals, hashCode, indexOf, lastIndexOf, removeRange, set, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray
parallelStream, removeIf, stream
protected static final IndexOutOfBoundsException indexOutOfBoundsException
protected static final NoSuchElementException noSuchElementException
protected static final IllegalStateException illegalStateException
protected final T[] buffer
protected int nextRealIndex
protected int size
protected int nextBufferIndex
public boolean containsIndex(int index)
protected boolean indexOutOfBounds(int index)
public T get(int index) throws IndexOutOfBoundsException
Does not check for index < 0
for efficiency reasons, so be sure
not to pass negative indices.
get
in interface List<T>
get
in class AbstractList<T>
IndexOutOfBoundsException
public boolean add(T element)
add
in interface Collection<T>
add
in interface List<T>
add
in class AbstractList<T>
public void add(int index, T element) throws IndexOutOfBoundsException
Does not check for index < 0
for efficiency reasons, so be sure
not to pass negative indices.
add
in interface List<T>
add
in class AbstractList<T>
IndexOutOfBoundsException
protected T removeUnsafe(int index)
public T remove(int index) throws IndexOutOfBoundsException
Does not check for index < 0
for efficiency reasons, so be sure
not to pass negative indices.
remove
in interface List<T>
remove
in class AbstractList<T>
IndexOutOfBoundsException
public void clear()
clear
in interface Collection<T>
clear
in interface List<T>
clear
in class AbstractList<T>
public ListIterator<T> listIterator()
listIterator
in interface List<T>
listIterator
in class AbstractList<T>
public ListIterator<T> listIterator(int index)
listIterator
in interface List<T>
listIterator
in class AbstractList<T>
public T[] toArray()
toArray
in interface Collection<T>
toArray
in interface List<T>
toArray
in class AbstractCollection<T>
public int size()
size
in interface Collection<T>
size
in interface List<T>
size
in class AbstractCollection<T>
public int nextIndex()
public int lastIndex()
Copyright © 2015–2021 Fiji. All rights reserved.