List

The abstract class from which all DList implementations must be based, contains the standard APIs for using DList

Members

Functions

add
void add(T elem)

Adds the specified item to the end of the list.

add
void add(size_t index, T elem)

Adds the specified item to the list to the specified index.

addAll
void addAll(T[] otherArray)

Adds the elements contained in the array passed to the function at the end of the list.

addAll
void addAll(size_t index, T[] otherArray)

Adds the elements contained in the array passed to the function the list to the specified index. The first element of the array will be inserted at the specified index, then the other indexes of the other elements will be incremental

addAll
void addAll(List!T otherList)

Adds the elements contained in the DList passed to the function at the end of the list

addAll
void addAll(size_t index, List!T otherList)

Adds the elements contained in the DList passed to the function the list to the specified index. The first element of the DList will be inserted at the specified index, then the other indexes of the other elements will be incremental

capacity
size_t capacity()

Returns the current capacity of the list. This capacity is not the maximum that the DList can obtain, it only indicates the current availability without allocating further memory

clear
void clear()

Removes all the elements of the array and deallocate all the memory.

contains
bool contains(T elem)

Returns true if the specified element is contained within the list.

containsAll
bool containsAll(T[] otherArray)

Returns true if the specified elements in the array are contained within the list.

containsAll
bool containsAll(List!T otherList)

Returns true if the specified elements in the DList are contained within the list.

get
T get(size_t index)

Returns the element contained in the list at the specified index.

getRef
T getRef(size_t index)

Returns by reference the element contained in the list at the specified index.

indexOf
long indexOf(T elem)

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.

isEmpty
bool isEmpty()

Returns true if no element is present in the list.

lastIndexOf
long lastIndexOf(T elem)

Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.

length
size_t length()

Returns the number of items in the list.

remove
void remove(size_t index)

Remove the element at the specified index.

removeAll
void removeAll(T[] otherArray)

Removes all the elements contained in the array from the list (looking for their index).

removeAll
void removeAll(List!T otherList)

Removes all the elements contained in the DList from the list (looking for their index).

reserve
void reserve(size_t numReserve)

Asks the implementation of the list to increase the capacity of the list than specified, the implementation MAY increase the allocated memory but it is NOT REQUIRED to do so. It is possible that in some implementations this method is simply ignored.

set
void set(size_t index, T elem)

Replaces the element at the specified position with the specified element.

subArray
T[] subArray(size_t indexFrom, size_t toIndex)

Generate and return an array from the specified portion of the list.

toArray
T[] toArray()

Returns an array containing all the elements of the list

Meta