Skip to content

Commit

Permalink
[collections] return nil if not found element
Browse files Browse the repository at this point in the history
  • Loading branch information
exilon committed Jun 10, 2021
1 parent f789dad commit ba5264e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Quick.Collections.pas
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ function TxList<T>.ExtractItem(const Value: T; Direction: TDirection): T;

function TxList<T>.First: T;
begin
if fList.Count > 0 then Result := fList.First;
if fList.Count > 0 then Result := fList.First
else Result := default(T);
end;

procedure TxList<T>.FromList(const aList: TList<T>);
Expand Down Expand Up @@ -377,7 +378,8 @@ procedure TxList<T>.InsertRange(Index: Integer; const Values: array of T);

function TxList<T>.Last: T;
begin
if fList.Count > 0 then Result := fList.Last;
if fList.Count > 0 then Result := fList.Last
else Result := default(T)
end;

function TxList<T>.LastIndexOf(const Value: T): Integer;
Expand Down

0 comments on commit ba5264e

Please sign in to comment.