TIntegerList class
Implements a specialization of TFPGList for Integer data types.
Declaration
TIntegerList = class()Description
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.
See also
Methods
Sort | public | Sorts the Integer values stored in the list. |
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
