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.
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. |
Modifiers | Return Types | Method and Description |
---|---|---|
public readonly get |
(int) |
size() Property should get the number of elements in the list as an |
public readonly get |
(long) |
sizeLong() Property should get the number of elements in the list as a |
public add(E element) => (List<E>)
Method should add the element to the end of the list.
element
- element to add
list after element is added
public clear() => (List<E>)
Removes all elements from the list. This operation should run in constant time.
list after being cleared
public readonly contains(E element) => (boolean)
Method should check whether the list contains a matching element.
element
- element to search for
true
if element is found
public delete(long index) => (E)
Method should delete the element at the specified index.
index
- location of element to delete
deleted element
public readonly indexOf(E element) => (long)
Method should return the index of the first matching element or -1 if no element matches.
element
- element to search for
index of element
public readonly isEmpty() => (boolean)
Method should check whether or not the list is empty.
true
if the list is empty
public remove(E element) => (boolean)
Method should remove the first element that matches the given element.
element
- element to remove
true
if element was found and removed