Provides lists for Integer data types implemented using generics.

integerlist.pas contains a list for Integer values implemented using generics, and provides the same methods and properties for Integer types as provided for String types in TStringList. Specializations are provided for the Byte, Word, Cardinal, Integer, and Int64 types. Each provides an overloaded Sort method to ensure that the type for the specialization is handled in the method.

This file is part of the LazUtils package.

Implements a specialization of TFPGList for the Byte data type.

TByteList provides an overloaded Sort method to ensure that values in the list are handled using a compare function that operates on Byte values. Internally, it provides a TFPGListEnumerator which is specialized for the Byte type used in the implementation.

Use the properties and methods defined in the ancestor class to perform common operations for Byte values, including:

- Add
- IndexOf
- Insert
- Extract
- Remove
- Sort
- AddList
- Assign
- First
- Last
- Items
- List

Items is the default property, and allows access to values by ordinal position or by using an enumerator to traverse the Byte values in List.

TFPGList TFPGListEnumerator
Sorts the Byte values stored in the list.

Sort is an overloaded method in TByteList which calls the inherited method using the CompareByte function defined in the implementation section.

TFPGList.Sort
Implements a specialization of TFPGList for the Word data type.

TWordList provides an overloaded Sort method to ensure that values in the list are handled using a compare function that operates on Word values. Internally, it provides a TFPGListEnumerator which is specialized for the Word type used in the implementation.

Use the properties and methods defined in the ancestor class to perform common operations for Word values, including:

- Add
- IndexOf
- Insert
- Extract
- Remove
- Sort
- AddList
- Assign
- First
- Last
- Items
- List

Items is the default property, and allows access to values by ordinal position or by using an enumerator to traverse the Word values in List.

// using TWordList properties and methods // var // AWordList: TWordList; // AIndex, ACount: Integer; // AMax, AValue: Word; AWordList := TWordList.Create; AMax := High(Word); AWordList.Add(Random(AMax)); AWordList.Add(Random(AMax)); AWordList.Add(Random(AMax)); AWordList.Add(Random(AMax)); AWordList.Insert(2, 42); AWordList.Sort; ACount := AWordList.Count; AIndex := AWordList.IndexOf(AWordList.Last); AValue := AWordList.Last; AWordList.Last := AValue - 1; AValue := AWordList.Extract(AInt64List.First); AIndex := AWordList.Remove(42); AWordList.Clear; AWordList.Free;
TFPGList TFPGListEnumerator
Sorts the Word values stored in the list.

Sort is an overloaded method in TWordList which calls the inherited method using the CompareWord function in the implementation section.

TFPGList.Sort
Implements a specialization of TFPGList for Cardinal data types.

TCardinalList provides an overloaded Sort method to ensure that values in the list are handled using a compare function that operates on Cardinal values. Internally, it provides a TFPGListEnumerator which is specialized for the Cardinal type used in the implementation.

Use the properties and methods defined in the ancestor class to perform common operations for Cardinal values, including:

- Add
- IndexOf
- Insert
- Extract
- Remove
- Sort
- AddList
- Assign
- First
- Last
- Items
- List

Items is the default property, and allows access to values by ordinal position or by using an enumerator to traverse the Cardinal values in List.

Example:

// using TCardinalList properties and methods // var // ACardinalList: TCardinalList; // AIndex, ACount: Integer; // AMax, AValue: Cardinal; ACardinalList := TCardinalList.Create; AMax := High(Cardinal); ACardinalList.Add(Random(AMax)); ACardinalList.Add(Random(AMax)); ACardinalList.Add(Random(AMax)); ACardinalList.Add(Random(AMax)); ACardinalList.Insert(2, 42); ACardinalList.Sort; ACount := ACardinalList.Count; AIndex := ACardinalList.IndexOf(ACardinalList.Last); AValue := ACardinalList.Last; ACardinalList.Last := AValue - 1; AValue := ACardinalList.Extract(AInt64List.First); AIndex := ACardinalList.Remove(42); ACardinalList.Clear; ACardinalList.Free;

Another example using TCardinalList can be found in the components/jcf2/ReadWrite/diffmerge.pas unit.

TFPGList.Sort TFPGList TFPGListEnumerator
Sorts the Word values stored in the list.

Sort is an overloaded method in TCardinalList which calls the inherited method using the CompareCardinal function in the implementation section.

TFPGList.Sort
Implements a specialization of TFPGList for Integer data types.

TIntegerList provides an overloaded Sort method to ensure that values in the list are handled using a compare function that operates on Integer values. Internally, it provides a TFPGListEnumerator which is specialized for the Integer type used in the implementation.

Use the properties and methods defined in the ancestor class to perform common operations for Integer values, including:

- Add
- IndexOf
- Insert
- Extract
- Remove
- Sort
- AddList
- Assign
- First
- Last
- Items
- List

Items is the default property, and allows access to values by ordinal position or by using an enumerator to traverse the Integer values in List.

Examples:

// using TIntegerList properties and methods // var // AIntegerList: TIntegerList; // AIndex, ACount: Integer; // AMax, AValue: Integer; AIntegerList := TIntegerList.Create; AMax := High(Integer); AIntegerList.Add(Random(AMax)); AIntegerList.Add(Random(AMax)); AIntegerList.Add(Random(AMax)); AIntegerList.Add(Random(AMax)); AIntegerList.Insert(2, 42); AIntegerList.Sort; ACount := AIntegerList.Count; AIndex := AIntegerList.IndexOf(AIntegerList.Last); AValue := AIntegerList.Last; AIntegerList.Last := AValue - 1; AValue := AIntegerList.Extract(AInt64List.First); AIndex := AIntegerList.Remove(42); AIntegerList.Clear; AIntegerList.Free;

An example using TIntegerList can be found in the implementation of the TCustomGrid class in lcl/grids.pas.

TFPGList.Sort TFPGList TFPGListEnumerator
Sorts the Integer values stored in the list.

Sort is an overloaded method in TIntegerList which calls the inherited method using the CompareInteger function in the implementation section.

TFPGList.Sort
Implements a specialization of TFPGList for Int64 data types.

TInt64List provides an overloaded Sort method to ensure that values in the list are handled using a compare function that operates on Int64 values. Internally, it provides a TFPGListEnumerator which is specialized for the Int64 type used in the implementation.

TIntegerList provides an overloaded Sort method to ensure that values in the list are handled using a compare function that operates on Int64 values. Internally, it provides a TFPGListEnumerator which is specialized for the Int64 type used in the implementation.

Use the properties and methods defined in the ancestor class to perform common operations for Integer values, including:

- Add
- IndexOf
- Insert
- Extract
- Remove
- Sort
- AddList
- Assign
- First
- Last
- Items
- List

Items is the default property, and allows access to values by ordinal position or by using an enumerator to traverse the Int64 values in List.

Example:

// using TInt64List properties and methods // var // AInt64List: TInt64List; // AIndex, ACount: Integer; // AMax, AValue: Int64; AInt64List := TInt64List.Create; ACount := 25; AMax := High(Int64);

for AIndex := 1 to ACount do AInt64List.Add(Random(AMax));

AInt64List.Insert(4, 42); AInt64List.Sort; ACount := AInt64List.Count; AIndex := AInt64List.IndexOf(AInt64List.Last); AValue := AInt64List.Last; AInt64List.Last := AValue - 1; AValue := AInt64List.Extract(AInt64List.First); AIndex := AInt64List.Remove(42); AInt64List.Clear; AInt64List.Free;
TFPGList.Sort TFPGList TFPGListEnumerator
Sorts the Int64 values stored in the list.

Sort is an overloaded method in TInt64List which calls the inherited method using the CompareInt64 function in the implementation section.

TFPGList.Sort