weiss.util
Interface List
- All Superinterfaces:
- Collection, java.io.Serializable
- All Known Implementing Classes:
- LinkedList, ArrayList
- public interface List
- extends Collection
List interface.
The version in java.util places the
union of sensible LinkedList and ArrayList methods in
this interface. We place the useful intersection here
instead, which is arguably empty.
Method Summary |
java.lang.Object |
get(int idx)
Returns the item at position idx. |
ListIterator |
listIterator(int pos)
Obtains a ListIterator object used to traverse the collection bidirectionally. |
java.lang.Object |
set(int idx,
java.lang.Object newVal)
Changes the item at position idx. |
get
public java.lang.Object get(int idx)
- Returns the item at position idx.
- Parameters:
idx
- the index to search in.- Throws:
IndexOutOfBoundsException
- if index is out of range.
set
public java.lang.Object set(int idx,
java.lang.Object newVal)
- Changes the item at position idx.
- Parameters:
idx
- the index to change.newVal
- the new value.- Returns:
- the old value.
- Throws:
IndexOutOfBoundsException
- if index is out of range.
listIterator
public ListIterator listIterator(int pos)
- Obtains a ListIterator object used to traverse the collection bidirectionally.
- Parameters:
idx
- the index to start the iterator. Use size() to do complete
reverse traversal. Use 0 to do complete forward traversal.- Throws:
IndexOutOfBoundsException
- if idx is not between 0 and size(), inclusive.