From dee43db2a71570c249421fb7d4f8003dc8774f16 Mon Sep 17 00:00:00 2001 From: Henrique Gottardi Werlang Date: Tue, 11 Jun 2024 19:04:52 -0300 Subject: [PATCH] IsEmpty functoin in the TList to Delphi compability. --- packages/rtl/src/generics.collections.pas | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/rtl/src/generics.collections.pas b/packages/rtl/src/generics.collections.pas index 48b50f8..b9a2428 100644 --- a/packages/rtl/src/generics.collections.pas +++ b/packages/rtl/src/generics.collections.pas @@ -185,6 +185,7 @@ type private function GetItem(AIndex: SizeInt): T; procedure SetItem(AIndex: SizeInt; const AValue: T); + function GetIsEmpty: Boolean; public type TEnumerator = class(TCustomListEnumerator); @@ -236,6 +237,7 @@ type function BinarySearch(const AItem: T; out AIndex: SizeInt; const AComparer: IComparer): Boolean; overload; property Count: SizeInt read FLength write SetCount; + property IsEmpty: Boolean read GetIsEmpty; property Items[Index: SizeInt]: T read GetItem write SetItem; default; end; @@ -890,6 +892,11 @@ begin Result := GetEnumerator; end; +function TList.GetIsEmpty: Boolean; +begin + Result := Count = 0; +end; + function TList.GetItem(AIndex: SizeInt): T; begin if (AIndex < 0) or (AIndex >= Count) then