protected static class ThriftyList.FixedListInternal<T> extends Object implements ThriftyList.ListInternal<T>, Cloneable
ThriftyList as it performs no bounds checking, delegating all
such responsibilities to ThriftyList itself.| Modifier and Type | Field and Description |
|---|---|
protected Object[] |
array |
protected int |
size |
| Constructor and Description |
|---|
FixedListInternal(int capacity)
Construct an empty instance with the specified capacity.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
T item)
Add the specified item to this list at the specified index, shifting
elements of this list if necessary.
|
void |
addAll(ThriftyList.ListInternal<T> source)
Add all elements of the specified source list to this list.
|
void |
addHead(T item)
Add the specified item to the beginning of this list.
|
void |
addSome(ThriftyList.ListInternal<T> source,
int index,
int count)
Add a number of elements from the specified source list, beginning
with the element at the specified index and ending once the specified
count of added elements has been reached, to this list.
|
void |
addTail(T item)
Add the specified item to the end of this list.
|
int |
calculateFreeCapacity() |
int |
capacity() |
void |
clear()
Clear all elements from this list.
|
Object |
clone()
Clone this list.
|
void |
fill(T[] target,
int targetIndex,
int index,
int count)
Fill the specified array, beginning with the specified index, with
the data of this list.
|
T |
get(int index)
Get the element of this list at the specified index.
|
T |
getHead() |
T |
getTail() |
int |
indexOf(Object o)
Get the index of the first list element equal to the specified
Object.
|
boolean |
isEmpty() |
boolean |
isFull() |
int |
lastIndexOf(Object o)
Get the index of the last element equal to the specified Object.
|
T |
remove(int index)
Remove and return the element of this list at the specified index.
|
T |
removeHead()
Remove the head element of this list.
|
T |
removeTail()
Remove the tail element of this list.
|
T |
set(int index,
T item)
Set the element of this list at the specified index to the specified
item.
|
int |
size() |
String |
toString() |
protected Object[] array
protected int size
public FixedListInternal(int capacity)
capacity - the capacity of the list, must be a power of two.public void add(int index,
T item)
add in interface ThriftyList.ListInternal<T>index - the index at which to add the item.item - the item to add.public void addAll(ThriftyList.ListInternal<T> source)
addAll in interface ThriftyList.ListInternal<T>source - the source list.public void addHead(T item)
addHead in interface ThriftyList.ListInternal<T>item - the item to add to this list.public void addSome(ThriftyList.ListInternal<T> source, int index, int count)
addSome in interface ThriftyList.ListInternal<T>source - the source list.index - the index at which to begin adding elements to this list.count - the number of elements to add to this list.public void addTail(T item)
addTail in interface ThriftyList.ListInternal<T>item - the item to add to this list.public int calculateFreeCapacity()
calculateFreeCapacity in interface ThriftyList.ListInternal<T>public int capacity()
capacity in interface ThriftyList.ListInternal<T>public void clear()
clear in interface ThriftyList.ListInternal<T>public void fill(T[] target, int targetIndex, int index, int count)
fill in interface ThriftyList.ListInternal<T>target - the target array.targetIndex - the array index at which to begin filling the target array
with this list's data.index - the index of this list at which to begin filling the
target array.count - the number of elements to copy to the target array.public T get(int index)
get in interface ThriftyList.ListInternal<T>index - the index of the desired element.public T getHead()
getHead in interface ThriftyList.ListInternal<T>public T getTail()
getTail in interface ThriftyList.ListInternal<T>public int indexOf(Object o)
indexOf in interface ThriftyList.ListInternal<T>o - the Object for which to search.public boolean isEmpty()
isEmpty in interface ThriftyList.ListInternal<T>public boolean isFull()
isFull in interface ThriftyList.ListInternal<T>public int lastIndexOf(Object o)
lastIndexOf in interface ThriftyList.ListInternal<T>o - the Object for which to search.public T remove(int index)
remove in interface ThriftyList.ListInternal<T>index - the index of the element to remove.public T removeHead()
removeHead in interface ThriftyList.ListInternal<T>public T removeTail()
removeTail in interface ThriftyList.ListInternal<T>public T set(int index, T item)
set in interface ThriftyList.ListInternal<T>index - the index at which to set the item.item - the item to set to this list.public int size()
size in interface ThriftyList.ListInternal<T>Copyright © 1994–2024 Peter Murray-Rust. All rights reserved.