Interface List
access this type via: data.adt.List (provides, requires or uses)
An ordered list of items.
Transfer fields
Data content[]
int iteratorIndex
Functions
void add(storeData item)
void remove(Data item)
void update(Data item, storeData newVersion)
Data getFirst()
Data getNext()
bool isEnd()
Data getIndex(int n)
int getLength()
Data[] getContents()
Transfer fields
content The contents of the list.
iteratorIndex
void add(storeData item)
Add a new item to the list; this function adds a reference (shallow copy) of the given item onto the list.
void remove(Data item)
Remove an item from the list; this function locates the given item using a reference (===) check.
void update(Data item, storeData newVersion)
Update an existing list item to a new version. This locates the given item using a reference (===) check, then replaces that reference with the reference to newVersion.
Data getFirst()
Iterator: call this function to begin iterating over the list. Note that this function, together with getNext(), are not thread-safe: if getFirst() is called by thread A, which then begins using getNext() to iterate through the list, a second call of getFirst() by thread B will reset thread A's iterator.
returns: The first element in the list, or null if the list is empty.
Data getNext()
Iterator: call this function to get the next element in the list.
returns: The next element in the list, or null if the end of the list has been reached.
bool isEnd()
Iterator: call this function to check if we've reached the end of the list, such that calling getNext() again would return null as there are no more items.
returns: True if the end of the list has been reached; false otherwise.
Data getIndex(int n)
Get the data instance at this index in the list.
returns: The data instance at this index, if any, or null if the index is out of bounds or empty.
int getLength()
Data[] getContents()