T - Type of the item stored in the model.public class ListModel<T>
extends java.lang.Object
implements java.lang.Iterable<T>
| Modifier and Type | Field and Description |
|---|---|
private java.util.ArrayList<T> |
list
Item container.
|
| Constructor and Description |
|---|
ListModel() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
T item)
Add item into model at specified position.
|
void |
add(T item)
Add item into model.
|
void |
clear()
Remove all items.
|
T |
get(int index)
Retrieve item at specified index.
|
int |
indexOf(T item)
Get index of item with specified value.
|
java.util.Iterator<T> |
iterator() |
void |
removeAt(int index)
Remove item at specified position.
|
int |
size()
Get count of items in the model.
|
private java.util.ArrayList<T> list
public java.util.Iterator<T> iterator()
iterator in interface java.lang.Iterable<T>Iterable.iterator()public void add(T item)
item - Item to add.public void add(int index,
T item)
index - Position in model.item - Item to add.public void clear()
public int indexOf(T item)
item - Item value to locate.public T get(int index)
index - Item index.null if index is out of range.public int size()
public void removeAt(int index)
index - Item index.