[Overview][Classes][Index] Reference for unit 'IntegerList' (#lazutils)

TIntegerList

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Implements a specialization of TFPGList for Integer data types.

Declaration

Source position: integerlist.pas line 40

type TIntegerList = class()

public

  procedure Sort; overload;

  

Sorts the Integer values stored in the list.

end;

Inheritance

TIntegerList

  

Implements a specialization of TFPGList for Integer data types.

|

?

TObject

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:

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

TByteList

  

Implements a specialization of TFPGList for the Byte data type.

TWordList

  

Implements a specialization of TFPGList for the Word data type.

TCardinalList

  

Implements a specialization of TFPGList for Cardinal data types.

TInt64List

  

Implements a specialization of TFPGList for Int64 data types.

TIntegerList.Sort

  

Sorts the Integer values stored in the list.

TFPGList.Sort

TFPGList

TFPGListEnumerator


Version 3.2 Generated 2024-02-25 Home