Modifier and Type | Class and Description |
---|---|
static interface |
BoundedList.INode<T>
The list elements are stored in nodes that takes care of the actual linking.
|
Constructor and Description |
---|
BoundedList(int maxSize)
Create a new bounded list.
|
Modifier and Type | Method and Description |
---|---|
void |
add(T t)
Adds a value to this list.
|
T |
getFirst()
Get the first element in the list.
|
T |
getLast()
Get the last element in the list.
|
int |
getMaxSize()
Get the maximum number of elements to retain in this list.
|
int |
getSize()
Get the number of elements in this list.
|
Iterator<T> |
iterator()
Get an iterator from the first available to the last available element at the time the
iterator was created.
|
void |
setMaxSize(int maxSize)
Set the maximum number of elements to retain in this list.
|
String |
toString()
Use only for debugging purposes!
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public BoundedList(int maxSize)
maxSize
- maximum number of elements to keeppublic void add(T t)
t
- the value to addpublic Iterator<T> iterator()
public T getFirst()
public T getLast()
public int getSize()
public int getMaxSize()
public void setMaxSize(int maxSize)
maxSize
- the maximum size of the listCopyright © 2018. All rights reserved.