public interface Sequence<T>
Modifier and Type | Interface and Description |
---|---|
static class |
Sequence.Tree<T>
Collection of static utility methods providing path access to nested
sequence data.
|
Modifier and Type | Method and Description |
---|---|
int |
add(T item)
Adds an item to the sequence.
|
T |
get(int index)
Retrieves the item at the given index.
|
int |
getLength()
Returns the length of the sequence.
|
int |
indexOf(T item)
Returns the index of an item in the sequence.
|
void |
insert(T item,
int index)
Inserts an item into the sequence at a specific index.
|
Sequence<T> |
remove(int index,
int count)
Removes one or more items from the sequence.
|
int |
remove(T item)
Removes the first occurrence of the given item from the sequence.
|
T |
update(int index,
T item)
Updates the item at the given index.
|
int add(T item)
item
- The item to be added to the sequence.void insert(T item, int index)
item
- The item to be added to the sequence.index
- The index at which the item should be inserted. Must be a value between
0 and getLength().T update(int index, T item)
index
- The index of the item to update.item
- The item that will replace any existing value at the given index.int remove(T item)
item
- The item to remove.remove(int, int)
Sequence<T> remove(int index, int count)
index
- The starting index to remove.count
- The number of items to remove, beginning with index.T get(int index)
index
- The index of the item to retrieve.int indexOf(T item)
item
- The item to locate.int getLength()