List Routines
42 nodes
On this page 42
Add
FunctionAppends an element to the end of the list.
Add(list: List of T, item: T)
void Add(List<T> list, T item)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to extend; null throws System.ArgumentNullException. |
| item | T | — | The element to append; null is allowed for reference types. |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Add Range
FunctionAppends every element of a sequence to the end of the list, keeping their order.
AddRange(list: List of T, items: IEnumerable<T>)
void AddRange(List<T> list, IEnumerable<T> items)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to extend; null throws System.ArgumentNullException. |
| items | IEnumerable<T> | — | The elements to append; null throws System.ArgumentNullException. |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
As Read Only
FunctionA read-only view of the list, for handing its contents on without letting the receiver change them.
AsReadOnly(list: List of T) -> ReadOnlyCollection<T>
ReadOnlyCollection<T> AsReadOnly(List<T> list)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to wrap; null throws System.ArgumentNullException. |
Returns
| result | ReadOnlyCollection<T> |
Remarks
The view is not a copy: changes made to the list afterwards show through it.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Binary Search
FunctionOverload 1 of 3
BinarySearch(list: List of T, item: T) -> Integer
int BinarySearch(List<T> list, T item)
Finds a value in a list that is already sorted in ascending order, much faster than a front-to-back search on a long list.
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The sorted list to search; null throws System.ArgumentNullException. |
| item | T | — | The value to look for. |
Returns
| result | Integer |
Remarks
The result is only meaningful if the list is sorted by the same ordering; if several elements equal the value, any one of their positions may be returned. Elements that are not comparable throw System.InvalidOperationException.
Overload 2 of 3
BinarySearch -> Integer
list: List of T
item: T
comparer: IComparer<T>int BinarySearch(List<T> list, T item, IComparer<T> comparer)
Finds a value in a list that is already sorted by the given comparer, much faster than a front-to-back search on a long list.
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The sorted list to search; null throws System.ArgumentNullException. |
| item | T | — | The value to look for. |
| comparer | IComparer<T> | — | The ordering the list is sorted by; null uses the elements' default ordering. |
Returns
| result | Integer |
Remarks
The result is only meaningful if the list is sorted by the same comparer; if several elements equal the value, any one of their positions may be returned.
Overload 3 of 3
BinarySearch -> Integer
list: List of T
index: Integer
count: Integer
item: T
comparer: IComparer<T>int BinarySearch(
List<T> list,
int index,
int count,
T item,
IComparer<T> comparer)Finds a value within a section of the list, where that section is already sorted by the given comparer.
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to search; null throws System.ArgumentNullException. |
| index | Integer | — | The zero-based position where the section starts; negative throws System.ArgumentOutOfRangeException. |
| count | Integer | — | How many elements the section covers; negative throws System.ArgumentOutOfRangeException, and a section past the end throws System.ArgumentException. |
| item | T | — | The value to look for. |
| comparer | IComparer<T> | — | The ordering the section is sorted by; null uses the elements' default ordering. |
Returns
| result | Integer |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Capacity
FunctionHow many elements the list can hold before it has to grow its storage; always at least its count.
Capacity(list: List of T) -> Integer
int Capacity(List<T> list)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to inspect; null throws System.ArgumentNullException. |
Returns
| result | Integer |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Clear
FunctionRemoves every element, leaving an empty list; its reserved capacity is kept.
Clear(list: List of T)
void Clear(List<T> list)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to empty; null throws System.ArgumentNullException. |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Clone
FunctionA new list with the same elements in the same order, so the copy can be changed without affecting the original.
Clone(list: List of T) -> List of T
List<T> Clone(List<T> list)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to copy; null throws System.ArgumentNullException. |
Returns
| result | List of T |
Remarks
The copy is shallow: for elements that are objects, both lists refer to the same objects.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Contains
FunctionWhether the list holds an element equal to the given value.
Contains(list: List of T, item: T) -> Truth
bool Contains(List<T> list, T item)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to search; null throws System.ArgumentNullException. |
| item | T | — | The value to look for, compared by equality. |
Returns
| result | Truth |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Convert All
FunctionA new list made by passing each element through a converter, for turning a list of one type into another, such as numbers into labels.
ConvertAll -> List of TOut
list: List of TIn
converter: Converter<TIn, TOut>List<TOut> ConvertAll(
List<TIn> list,
Converter<TIn, TOut> converter)Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of TIn | — | The list to convert; it is left unchanged, and null throws System.ArgumentNullException. |
| converter | Converter<TIn, TOut> | — | The function applied to each element; null throws System.ArgumentNullException. |
Returns
| result | List of TOut |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Copy To
FunctionOverload 1 of 3
CopyTo(list: List of T, array: T Array)
void CopyTo(List<T> list, T[] array)
Copies every element of the list into an existing array, starting at the array's first slot.
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to copy from; null throws System.ArgumentNullException. |
| array | T Array | — | The array to copy into; null throws System.ArgumentNullException, and one shorter than the list throws System.ArgumentException. |
Overload 2 of 3
CopyTo(list: List of T, array: T Array, arrayIndex: Integer)
void CopyTo(List<T> list, T[] array, int arrayIndex)
Copies every element of the list into an existing array, starting at a given slot of the array.
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to copy from; null throws System.ArgumentNullException. |
| array | T Array | — | The array to copy into; null throws System.ArgumentNullException. |
| arrayIndex | Integer | — | The array position where the first element lands; too little room after it for the whole list throws System.ArgumentException. |
Overload 3 of 3
CopyTo
list: List of T
index: Integer
array: T Array
arrayIndex: Integer
count: Integervoid CopyTo(
List<T> list,
int index,
T[] array,
int arrayIndex,
int count)Copies a run of the list's elements into an existing array at a given slot.
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to copy from; null throws System.ArgumentNullException. |
| index | Integer | — | The zero-based list position of the first element to copy. |
| array | T Array | — | The array to copy into; null throws System.ArgumentNullException. |
| arrayIndex | Integer | — | The array position where the first copied element lands. |
| count | Integer | — | How many elements to copy; a negative position or count throws System.ArgumentOutOfRangeException, and a run past the end of the list or of the array throws System.ArgumentException. |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Count
FunctionHow many elements the list currently holds.
Count(list: List of T) -> Integer
int Count(List<T> list)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to count; null throws System.ArgumentNullException. |
Returns
| result | Integer |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Create
FunctionOverload 1 of 3
Create() -> List of T
List<T> Create()
A new, empty list that you can add elements to.
Returns
| result | List of T |
Overload 2 of 3
Create(capacity: Integer) -> List of T
List<T> Create(int capacity)
A new, empty list with room reserved for a number of elements, which avoids repeated regrowth when you know roughly how many you will add.
Parameters
| name | type | default | description |
|---|---|---|---|
| capacity | Integer | — | How many elements to reserve room for; this is not the list's length, which starts at 0. Negative throws System.ArgumentOutOfRangeException. |
Returns
| result | List of T |
Overload 3 of 3
Create(source: IEnumerable<T>) -> List of T
List<T> Create(IEnumerable<T> source)
A new list holding the elements of an existing sequence, such as an array, in the same order.
Parameters
| name | type | default | description |
|---|---|---|---|
| source | IEnumerable<T> | — | The elements to copy into the list; null throws System.ArgumentNullException. |
Returns
| result | List of T |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Ensure Capacity
FunctionMakes sure the list has room for at least the given number of elements, growing its storage if it is smaller; the elements themselves are not changed.
EnsureCapacity(list: List of T, capacity: Integer) -> Integer
int EnsureCapacity(List<T> list, int capacity)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to prepare; null throws System.ArgumentNullException. |
| capacity | Integer | — | The minimum number of elements to have room for; negative throws System.ArgumentOutOfRangeException. |
Returns
| result | Integer |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Exists
FunctionWhether at least one element passes a test, for questions such as "is any value negative?".
Exists(list: List of T, match: Predicate<T>) -> Truth
bool Exists(List<T> list, Predicate<T> match)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to check; null throws System.ArgumentNullException. |
| match | Predicate<T> | — | The test applied to each element; null throws System.ArgumentNullException. |
Returns
| result | Truth |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Find
FunctionThe first element, from the front, that passes a test.
Find(list: List of T, match: Predicate<T>) -> T
T Find(List<T> list, Predicate<T> match)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to search; null throws System.ArgumentNullException. |
| match | Predicate<T> | — | The test applied to each element; null throws System.ArgumentNullException. |
Returns
| Result | T |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Find Index
FunctionOverload 1 of 3
FindIndex(list: List of T, match: Predicate<T>) -> Integer
int FindIndex(List<T> list, Predicate<T> match)
The position of the first element that passes a test, searching from the front.
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to search; null throws System.ArgumentNullException. |
| match | Predicate<T> | — | The test applied to each element; null throws System.ArgumentNullException. |
Returns
| result | Integer |
Overload 2 of 3
FindIndex -> Integer
list: List of T
startIndex: Integer
match: Predicate<T>int FindIndex(List<T> list, int startIndex, Predicate<T> match)
The position of the first element passing a test, searching forwards from a given index to the end.
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to search; null throws System.ArgumentNullException. |
| startIndex | Integer | — | The zero-based index where the search starts; below 0 or above the count throws System.ArgumentOutOfRangeException. |
| match | Predicate<T> | — | The test applied to each element; null throws System.ArgumentNullException. |
Returns
| result | Integer |
Overload 3 of 3
FindIndex -> Integer
list: List of T
startIndex: Integer
count: Integer
match: Predicate<T>int FindIndex(
List<T> list,
int startIndex,
int count,
Predicate<T> match)The position of the first element passing a test within a section of the list, searching forwards.
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to search; null throws System.ArgumentNullException. |
| startIndex | Integer | — | The zero-based index where the search starts. |
| count | Integer | — | How many elements to examine; a section outside the list throws System.ArgumentOutOfRangeException. |
| match | Predicate<T> | — | The test applied to each element; null throws System.ArgumentNullException. |
Returns
| result | Integer |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Find Last
FunctionThe last element, searching from the back, that passes a test.
FindLast(list: List of T, match: Predicate<T>) -> T
T FindLast(List<T> list, Predicate<T> match)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to search; null throws System.ArgumentNullException. |
| match | Predicate<T> | — | The test applied to each element; null throws System.ArgumentNullException. |
Returns
| Result | T |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
First
FunctionThe first element of the list.
First(list: List of T) -> T
T First(List<T> list)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to read; null throws System.ArgumentNullException. |
Returns
| Result | T |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
For Each
FunctionRuns an action once for each element, front to back, for side effects such as printing or accumulating.
ForEach(list: List of T, action: Action<T>)
void ForEach(List<T> list, Action<T> action)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to walk; null throws System.ArgumentNullException. |
| action | Action<T> | — | The action run on each element; null throws System.ArgumentNullException. |
Remarks
The action must not change the same list (adding, removing or replacing elements); doing so throws System.InvalidOperationException.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Get
FunctionThe element at a position in the list, counting from 0.
Get(list: List of T, index: Integer) -> T
T Get(List<T> list, int index)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to read; null throws System.ArgumentNullException. |
| index | Integer | — | The zero-based position; below 0 or not less than the count throws System.ArgumentOutOfRangeException. |
Returns
| Result | T |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Get Range
FunctionA new list holding a run of consecutive elements copied from this one.
GetRange -> List of T
list: List of T
index: Integer
count: IntegerList<T> GetRange(List<T> list, int index, int count)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to copy from; null throws System.ArgumentNullException. |
| index | Integer | — | The zero-based position of the first element to copy; negative throws System.ArgumentOutOfRangeException. |
| count | Integer | — | How many elements to copy; negative throws System.ArgumentOutOfRangeException, and a run past the end throws System.ArgumentException. |
Returns
| result | List of T |
Remarks
The copy is shallow, and changing the new list does not change the original.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Index Of
FunctionOverload 1 of 3
IndexOf(list: List of T, item: T) -> Integer
int IndexOf(List<T> list, T item)
The position of the first element equal to the given value, searching from the front.
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to search; null throws System.ArgumentNullException. |
| item | T | — | The value to look for, compared by equality. |
Returns
| result | Integer |
Overload 2 of 3
IndexOf(list: List of T, item: T, index: Integer) -> Integer
int IndexOf(List<T> list, T item, int index)
The position of the first element equal to the given value, searching forwards from a given index to the end.
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to search; null throws System.ArgumentNullException. |
| item | T | — | The value to look for, compared by equality. |
| index | Integer | — | The zero-based index where the search starts; below 0 or above the count throws System.ArgumentOutOfRangeException. |
Returns
| result | Integer |
Overload 3 of 3
IndexOf -> Integer
list: List of T
item: T
index: Integer
count: Integerint IndexOf(List<T> list, T item, int index, int count)
The position of the first element equal to the given value within a section of the list, searching forwards.
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to search; null throws System.ArgumentNullException. |
| item | T | — | The value to look for, compared by equality. |
| index | Integer | — | The zero-based index where the search starts. |
| count | Integer | — | How many elements to examine; a section outside the list throws System.ArgumentOutOfRangeException. |
Returns
| result | Integer |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Insert
FunctionInserts an element at a position, moving the element there and everything after it one place along.
Insert(list: List of T, index: Integer, item: T)
void Insert(List<T> list, int index, T item)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to change; null throws System.ArgumentNullException. |
| index | Integer | — | The zero-based position the new element takes; equal to the count appends it, and below 0 or above the count throws System.ArgumentOutOfRangeException. |
| item | T | — | The element to insert. |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Insert Range
FunctionInserts every element of a sequence at a position, keeping their order and moving the existing elements from there onwards along to make room.
InsertRange
list: List of T
index: Integer
items: IEnumerable<T>void InsertRange(List<T> list, int index, IEnumerable<T> items)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to change; null throws System.ArgumentNullException. |
| index | Integer | — | The zero-based position the first inserted element takes; equal to the count appends, and below 0 or above the count throws System.ArgumentOutOfRangeException. |
| items | IEnumerable<T> | — | The elements to insert; null throws System.ArgumentNullException. |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Is Empty
FunctionWhether the list has no elements.
IsEmpty(list: List of T) -> Truth
bool IsEmpty(List<T> list)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to check; null throws System.ArgumentNullException. |
Returns
| result | Truth |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Last
FunctionThe last element of the list.
Last(list: List of T) -> T
T Last(List<T> list)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to read; null throws System.ArgumentNullException. |
Returns
| Result | T |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Last Index Of
FunctionThe position of the last element equal to the given value, searching from the back.
LastIndexOf(list: List of T, item: T) -> Integer
int LastIndexOf(List<T> list, T item)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to search; null throws System.ArgumentNullException. |
| item | T | — | The value to look for, compared by equality. |
Returns
| result | Integer |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Remove
FunctionRemoves the first element equal to the given value, if there is one; later duplicates stay.
Remove(list: List of T, item: T) -> Truth
bool Remove(List<T> list, T item)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to change; null throws System.ArgumentNullException. |
| item | T | — | The value to remove, compared by equality. |
Returns
| result | Truth |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Remove All
FunctionRemoves every element that passes a test, for filtering a list in place.
RemoveAll(list: List of T, match: Predicate<T>) -> Integer
int RemoveAll(List<T> list, Predicate<T> match)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to change; null throws System.ArgumentNullException. |
| match | Predicate<T> | — | The test applied to each element; matching elements are removed. Null throws System.ArgumentNullException. |
Returns
| result | Integer |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Remove At
FunctionRemoves the element at a position, moving everything after it one place back.
RemoveAt(list: List of T, index: Integer)
void RemoveAt(List<T> list, int index)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to change; null throws System.ArgumentNullException. |
| index | Integer | — | The zero-based position to remove; below 0 or not less than the count throws System.ArgumentOutOfRangeException. |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Remove Range
FunctionRemoves a run of consecutive elements, moving everything after them back to close the gap.
RemoveRange(list: List of T, index: Integer, count: Integer)
void RemoveRange(List<T> list, int index, int count)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to change; null throws System.ArgumentNullException. |
| index | Integer | — | The zero-based position of the first element to remove; negative throws System.ArgumentOutOfRangeException. |
| count | Integer | — | How many elements to remove; negative throws System.ArgumentOutOfRangeException, and a run past the end throws System.ArgumentException. |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Reverse
FunctionOverload 1 of 2
Reverse(list: List of T)
void Reverse(List<T> list)
Reverses the order of all elements in place, so the last becomes first.
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to reverse; null throws System.ArgumentNullException. |
Overload 2 of 2
Reverse(list: List of T, index: Integer, count: Integer)
void Reverse(List<T> list, int index, int count)
Reverses the order of a run of elements in place, leaving the rest of the list as it was.
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to change; null throws System.ArgumentNullException. |
| index | Integer | — | The zero-based position of the first element of the run; negative throws System.ArgumentOutOfRangeException. |
| count | Integer | — | How many elements the run covers; negative throws System.ArgumentOutOfRangeException, and a run past the end throws System.ArgumentException. |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Set
FunctionReplaces the element at a position in the list with a new value.
Set(list: List of T, index: Integer, value: T)
void Set(List<T> list, int index, T value)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to change; null throws System.ArgumentNullException. |
| index | Integer | — | The zero-based position to overwrite; below 0 or not less than the count throws System.ArgumentOutOfRangeException (use Add or Insert to extend the list). |
| value | T | — | The value to store. |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Set Capacity
FunctionSets exactly how many elements the list has room for, to reserve space ahead of time or release unused space.
SetCapacity(list: List of T, capacity: Integer)
void SetCapacity(List<T> list, int capacity)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to change; null throws System.ArgumentNullException. |
| capacity | Integer | — | The new capacity; it cannot be negative or less than the list's count, either of which throws System.ArgumentOutOfRangeException. |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Slice
FunctionA new list holding a run of consecutive elements copied from this one; the same as Get Range, named for those used to slicing.
Slice -> List of T
list: List of T
start: Integer
length: IntegerList<T> Slice(List<T> list, int start, int length)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to copy from; null throws System.ArgumentNullException. |
| start | Integer | — | The zero-based position of the first element to copy; negative throws System.ArgumentOutOfRangeException. |
| length | Integer | — | How many elements to copy (not an end position); negative throws System.ArgumentOutOfRangeException, and a run past the end throws System.ArgumentException. |
Returns
| result | List of T |
Remarks
The copy is shallow, and changing the new list does not change the original.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Sort
FunctionOverload 1 of 4
Sort(list: List of T)
void Sort(List<T> list)
Sorts the list in place in ascending order: numbers smallest first, text alphabetically.
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to sort; null throws System.ArgumentNullException. |
Remarks
The sort is not stable: elements that compare equal may change order. Elements that are not comparable throw System.InvalidOperationException.
Overload 2 of 4
Sort(list: List of T, comparer: IComparer<T>)
void Sort(List<T> list, IComparer<T> comparer)
Sorts the list in place using the given comparer.
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to sort; null throws System.ArgumentNullException. |
| comparer | IComparer<T> | — | The ordering to sort by; null uses the elements' default ordering, which throws System.InvalidOperationException if the elements are not comparable. |
Remarks
The sort is not stable: elements that compare equal may change order.
Overload 3 of 4
Sort
list: List of T
index: Integer
count: Integer
comparer: IComparer<T>void Sort(
List<T> list,
int index,
int count,
IComparer<T> comparer)Sorts a run of elements in place using the given comparer, leaving the rest of the list as it was.
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to sort; null throws System.ArgumentNullException. |
| index | Integer | — | The zero-based position of the first element of the run; negative throws System.ArgumentOutOfRangeException. |
| count | Integer | — | How many elements the run covers; negative throws System.ArgumentOutOfRangeException, and a run past the end throws System.ArgumentException. |
| comparer | IComparer<T> | — | The ordering to sort by; null uses the elements' default ordering. |
Remarks
The sort is not stable.
Overload 4 of 4
Sort(list: List of T, comparison: Comparison<T>)
void Sort(List<T> list, Comparison<T> comparison)
Sorts the list in place using a comparison function, for orderings such as by length or descending.
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to sort; null throws System.ArgumentNullException. |
| comparison | Comparison<T> | — | The function that orders two elements; null throws System.ArgumentNullException. |
Remarks
The comparison returns a negative number when the first argument comes first, 0 when they are equal and a positive number when the second comes first. The sort is not stable.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
To Array
FunctionThe list's elements copied into a new array, in the same order, for nodes that take an array.
ToArray(list: List of T) -> T Array
T[] ToArray(List<T> list)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to copy; null throws System.ArgumentNullException. |
Returns
| result | T Array |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Trim Excess
FunctionShrinks the list's reserved storage to fit its elements, to give memory back once a list has finished growing.
TrimExcess(list: List of T)
void TrimExcess(List<T> list)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to trim; null throws System.ArgumentNullException. |
Remarks
Nothing happens if the list already uses more than about 90% of its capacity, since reallocating would cost more than it saves.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
True For All
FunctionWhether every element passes a test, for questions such as "are all values positive?".
TrueForAll(list: List of T, match: Predicate<T>) -> Truth
bool TrueForAll(List<T> list, Predicate<T> match)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to check; null throws System.ArgumentNullException. |
| match | Predicate<T> | — | The test applied to each element; null throws System.ArgumentNullException. |
Returns
| result | Truth |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Try First
FunctionReads the first element if the list has one, without throwing on an empty list.
TryFirst(list: List of T) -> (result: Truth, value: T)
bool TryFirst(List<T> list, out T value)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to read; null throws System.ArgumentNullException. |
Returns
| result | Truth |
| value | T |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Try Get
FunctionReads the element at a position if there is one, without throwing when the position is out of range.
TryGet -> (result: Truth, value: T)
list: List of T
index: Integerbool TryGet(List<T> list, int index, out T value)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to read; null throws System.ArgumentNullException. |
| index | Integer | — | The zero-based position to read. |
Returns
| result | Truth |
| value | T |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library
Try Last
FunctionReads the last element if the list has one, without throwing on an empty list.
TryLast(list: List of T) -> (result: Truth, value: T)
bool TryLast(List<T> list, out T value)
Parameters
| name | type | default | description |
|---|---|---|---|
| list | List of T | — | The list to read; null throws System.ArgumentNullException. |
Returns
| result | Truth |
| value | T |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- List Routines
- Package
- Standard Library