|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface List<T>
Collection interface representing an ordered sequence of items.
Nested Class Summary | |
---|---|
static interface |
List.ItemIterator<T>
Optional item iterator interface. |
static class |
List.ListListenerList<T>
List listener list. |
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Sequence |
---|
Sequence.Tree<T> |
Method Summary | |
---|---|
int |
add(T item)
Adds an item to the list. |
void |
clear()
Removes all elements from the collection. |
int |
getLength()
Returns the length of the list. |
ListenerList<ListListener<T>> |
getListListeners()
Returns the list listener list. |
void |
insert(T item,
int index)
Inserts an item into the list. |
Sequence<T> |
remove(int index,
int count)
Removes one or more items from the sequence. |
void |
setComparator(Comparator<T> comparator)
Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order. |
T |
update(int index,
T item)
Updates the item at the given index. |
Methods inherited from interface org.apache.pivot.collections.Sequence |
---|
get, indexOf, remove |
Methods inherited from interface org.apache.pivot.collections.Collection |
---|
getComparator, isEmpty |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Method Detail |
---|
int add(T item)
add
in interface Sequence<T>
item
- The item to be added to the sequence.
ListListener.itemInserted(List, int)
void insert(T item, int index)
insert
in interface Sequence<T>
item
- The item to be added to the list.index
- The index at which the item should be inserted. Must be a value between
0 and getLength().
IllegalArgumentException
- If the list is sorted and the insertion point of the item does not match
the given index.ListListener.itemInserted(List, int)
T update(int index, T item)
update
in interface Sequence<T>
index
- The index of the item to update.item
- The item that will replace any existing value at the given index.
IllegalArgumentException
- If the list is sorted and the index of the updated item would be
different than its current index.ListListener.itemUpdated(List, int, Object)
Sequence<T> remove(int index, int count)
Sequence
remove
in interface Sequence<T>
index
- The starting index to remove.count
- The number of items to remove, beginning with index.
ListListener.itemsRemoved(List, int, Sequence)
void clear()
Collection
clear
in interface Collection<T>
ListListener.itemsRemoved(List, int, Sequence)
int getLength()
getLength
in interface Sequence<T>
void setComparator(Comparator<T> comparator)
Collection
Calling this method more than once with the same comparator will re-sort the collection.
setComparator
in interface Collection<T>
comparator
- The comparator used to order elements in the collection, or null if the
collection is unsorted.ListListener.comparatorChanged(List, Comparator)
ListenerList<ListListener<T>> getListListeners()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |