[Overview][Constants][Types][Classes][Index] | Reference for unit 'fgl' (#rtl)

# TFPGMapObject

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Generic map

## Declaration

Source position: fgl.pp line 341

`type generic TFPGMapObject <TKey,TData>= class(TFPSMap)`
`public`
`constructor Create();` |  | Create a new instance of the map
`function Add();` |  | Add a key and value to the map
`function Find();` |  | Find item based on key
`function TryGetData();` |  | Find data or return default
`procedure AddOrSetData();` |  | Add data with given or set value if the key already exists.
`function IndexOf();` |  | Find index of a key in the list.
`function IndexOfData();` |  | Find index of data value in the list.
`procedure InsertKey();` |  | Insert a new key in the list
`procedure InsertKeyData();` |  | Insert a new key with associated data in the list
`function Remove();` |  | Remove a key from the list
`property Keys []: TKey; [rw]` |  | Indexed access to the keys in the list.
`property Data []: TData; [rw]` |  | Indexed access to the data in the list
`property KeyData []: TData; default; [rw]` |  | Access to data based on key
`property OnCompare: TKeyCompareFunc; [rw]` |  | Alias for OnKeyCompare
`property OnKeyCompare: TKeyCompareFunc; [rw]` |  | Compare function for key values.
`property OnDataCompare: TDataCompareFunc; [rw]` |  | Compare function for data values.
`end;`

## Inheritance

`TFPGMapObject` |  | Generic map
`TFPSMap` |  | Basic map object, used in generic maps
`TFPSList` |  | Basic list of memory blocks
`TObject` |  | Base class of all classes.

## Description

TFPGMapObject is a generic map class. It can be used to specialize a map for object types, but not objects with automated reference counting: For reference counted interface objects, TFPGMapInterfacedObjectData must be used.

## See also

TFPGMapInterfacedObjectData |  | Generic map for reference counted objects

Documentation generated on: May 14 2021