Skip to main content

TdxFastList.Extract(Pointer,TdxListDirection) Method

Removes the specified stored pointer and returns it.

Declaration

function Extract(AItem: Pointer; ADirection: TdxListDirection = ldFromBeginning): Pointer;

Parameters

Name Type
AItem Pointer
ADirection TdxListDirection

Returns

Type
Pointer

Remarks

Call this function and pass a pointer as the AItem parameter to remove the pointer from the ordered pointer list. Pass ldFromEnd as the optional ADirection parameter to reverse the default search direction, which can be useful if the list is sorted. If the list contains the specified pointer, the Extract function:

  • Removes the pointer from the list.

  • Returns the removed pointer.

  • Decrements the Count property value by one.

  • Shifts any remaining pointers at the end of the original list by one position towards the list’s beginning.

Otherwise, the Extract function returns nil (in Delphi) or NULL/nullptr (in C++Builder).

Note

The Extract function calls the IndexOf function internally to search the specified pointer. Call The ExtractByIndex function instead if you need to extract a stored pointer by its known position (that is, the index) within the list.

See Also