System.Generics.Collections.TArray.LastIndexOf
Delphi
class function LastIndexOf<T>(const Values: array of T; const Item: T): NativeInt; overload; static;
class function LastIndexOf<T>(const Values: array of T; const Item: T;
Index: NativeInt): NativeInt; overload; static;
class function LastIndexOf<T>(const Values: array of T; const Item: T;
const Comparer: IComparer<T>; Index, Count: NativeInt): NativeInt; overload; static;
C++
template<typename T> static System::NativeInt __fastcall LastIndexOf(const T *Values, const System::NativeInt Values_High, const T Item)/* overload */;
template<typename T> static System::NativeInt __fastcall LastIndexOf(const T *Values, const System::NativeInt Values_High, const T Item, System::NativeInt Index)/* overload */;
template<typename T> static System::NativeInt __fastcall LastIndexOf(const T *Values, const System::NativeInt Values_High, const T Item, const System::DelphiInterface<System::Generics::Defaults::IComparer__1<T> > Comparer, System::NativeInt Index, System::NativeInt Count)/* overload */;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.Generics.Collections.pas System.Generics.Collections.hpp |
System.Generics.Collections | TArray |
Description
Gets the zero-based index of the last instance of Value
in the array. If it is not found, the function returns -1
.
Since the search is linear, it is an O(n) operation for an array with n entries.