shadow:utility

Interface List<E>

Interfaces

shadow:standard@CanIterate<E>, shadow:standard@CanIndex<long,E>, shadow:standard@CanIndexStore<long,E>

interface List<E>

Interface List<E> defines the operations that a container class must implement to be an ordered list. A list supports general operations for storing and retrieving elements at indexes.

Method Summary

Modifiers Return Types Method and Description
public (List<E>) add(E element)

Method should add the element to the end of the list.

public (List<E>) clear()

Removes all elements from the list.

public readonly (boolean) contains(E element)

Method should check whether the list contains a matching element.

public (E) delete(long index)

Method should delete the element at the specified index.

public readonly (long) indexOf(E element)

Method should return the index of the first matching element or -1 if no element matches.

public readonly (boolean) isEmpty()

Method should check whether or not the list is empty.

public (boolean) remove(E element)

Method should remove the first element that matches the given element.

Property Summary

Modifiers Return Types Method and Description
public readonly get (int) size()

Property should get the number of elements in the list as an int.

public readonly get (long) sizeLong()

Property should get the number of elements in the list as a long.

Method Detail

add

public add(E element) => (List<E>)

Method should add the element to the end of the list.

Parameters

element - element to add

Returns

list after element is added

clear

public clear() => (List<E>)

Removes all elements from the list. This operation should run in constant time.

Returns

list after being cleared

contains

public readonly contains(E element) => (boolean)

Method should check whether the list contains a matching element.

Parameters

element - element to search for

Returns

true if element is found

delete

public delete(long index) => (E)

Method should delete the element at the specified index.

Parameters

index - location of element to delete

Returns

deleted element

indexOf

public readonly indexOf(E element) => (long)

Method should return the index of the first matching element or -1 if no element matches.

Parameters

element - element to search for

Returns

index of element

isEmpty

public readonly isEmpty() => (boolean)

Method should check whether or not the list is empty.

Returns

true if the list is empty

remove

public remove(E element) => (boolean)

Method should remove the first element that matches the given element.

Parameters

element - element to remove

Returns

true if element was found and removed

Property Detail

size

public readonly get size() => (int)

Property should get the number of elements in the list as an int.

Returns

size of the list

sizeLong

public readonly get sizeLong() => (long)

Property should get the number of elements in the list as a long.

Returns

size of the list