Reference TArrayList<T>
Declared in Codebot.System.pas on line 164
TArrayList<T> is a simple extension to dynamic arrays
TArrayList<T> = record
public
{ Get the enumerator for the list }
function GetEnumerator: IEnumerator<T>;
{ The comparer used by Sort and IndexOf when no comparer is given }
DefaultCompare: TCompare<T>;
{ The converter used by Join when no converter is given }
DefaultConvertString: TConvertString<T>;
{ The array acting as a list }
Items: TArray<T>;
{ Create a list containing a copy of an open array of items }
class function ArrayOf(const Items: array of T): TArrayList<T>; static;
{ Returns a new empty list }
class function Convert: TArrayList<T>; static;
{ Convert a list to an array }
class operator Implicit(const Value: TArrayList<T>): TArray<T>;
{ Convert an array to a list }
class operator Implicit(const Value: TArray<T>): TArrayList<T>;
{ Convert an open array to a list }
class operator Implicit(const Value: array of T): TArrayList<T>;
{ Performs a simple safe copy of up to N elements }
procedure Copy(out List: TArrayList<T>; N: Integer);
{ Performs a fast unsafe copy of up to N elements }
procedure CopyFast(out List: TArrayList<T>; N: Integer);
{ Returns the lower bounds of the list }
function Lo: Integer;
{ Returns the upper bounds of the list }
function Hi: Integer;
{ Reverses the items in the list }
procedure Reverse;
{ Swap two items in the list }
procedure Exchange(A, B: Integer);
{ Adds an item to the end of the list }
procedure Push(const Item: T);
{ Appends an array of items to the list }
procedure PushRange(const Collection: array of T);
{ Remove an item from the end of the list }
function Pop: T;
{ Remove an item randomly from the list }
function PopRandom: T;
{ Return a copy of the list with items passing through a filter }
function Filter(Func: TFilterFunc<T>): TArrayList<T>;
{ Return the first item matching a condition }
function FirstOf(Func: TFilterFunc<T>): T;
{ Removes an item by index from the list and decreases the count by one }
procedure Delete(Index: Integer);
{ Removes all items setting the count of the list to 0 }
procedure Clear;
{ Sort the items using a comparer }
procedure Sort(Order: TSortingOrder = soAscend; Comparer: TCompare<T> = nil);
{ Attempt to find the item using DefaultCompare }
function IndexOf(const Item: T): Integer;
{ Join the array into a string using a separator }
function Join(const Separator: string; Convert: TConvertString<T> = nil): string;
{ Returns true if there are no items in the list }
property IsEmpty: Boolean read GetIsEmpty;
{ First item in the list }
property First: T read GetFirst write SetFirst;
{ Last item in the list }
property Last: T read GetLast write SetLast;
{ Number of items in the list }
property Length: Integer read GetLength write SetLength;
{ Address where the first item is located }
property Data: Pointer read GetData;
{ Get or set an item }
property Item[Index: Integer]: T read GetItem write SetItem; default;
end;