System.Generics.Collections.TList.Sort

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure Sort; overload;
procedure Sort(const AComparer: IComparer<T>); overload;
procedure Sort(const AComparer: IComparer<T>; Index, Count: NativeInt); overload;

C++

void __fastcall Sort()/* overload */;
void __fastcall Sort(const System::DelphiInterface<System::Generics::Defaults::IComparer__1<T> > AComparer)/* overload */;
void __fastcall Sort(const System::DelphiInterface<System::Generics::Defaults::IComparer__1<T> > AComparer, System::NativeInt Index, System::NativeInt Count)/* overload */;

Properties

Type Visibility Source Unit Parent
procedure
function
public
System.Generics.Collections.pas
System.Generics.Collections.hpp
System.Generics.Collections TList

Description

Sort list.

This method sorts the list. If AComparer is provided, it is used to compare elements; otherwise the default comparator for the list elements is used.

This sort is an O(n log n) operation, where n is the number of list elements. A QuickSort algorithm is used, so the order of equal elements may not be preserved.

See Also

Code Examples