[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'contnrs' (#fcl)

# TFPObjectList

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

TFPList descendent which manages objects.

## Declaration

Source position: contnrs.pp line 31

`type TFPObjectList = class(TObject)`
`protected`
`function GetItem();`
`procedure SetItem();`
`procedure SetCapacity();`
`function GetCapacity;`
`public`
`procedure Create();` |  | Create a new object list
`destructor Destroy; override;` |  | Clears the list and destroys the list instance
`procedure Clear;` |  | Clear all elements in the list.
`function Add();` |  | Add an object to the list.
`procedure Delete();` |  | Delete an element from the list.
`procedure Exchange();` |  | Exchange the location of two objects
`function Expand;` |  | Expand the capacity of the list.
`function Extract();` |  | Extract an object from the list
`function Remove();` |  | Remove an item from the list.
`function IndexOf();` |  | Search for an object in the list
`function FindInstanceOf();` |  | Search for an instance of a certain class
`procedure Insert();` |  | Insert a new object in the list
`function First;` |  | Return the first non-nil object in the list
`function Last;` |  | Return the last non-nil object in the list.
`procedure Move();` |  | Move an object to another location in the list.
`procedure Assign();` |  | Copy the contents of a list.
`procedure Pack;` |  | Remove all Nil references from the list
`procedure Sort();` |  | Sort the list of objects
`procedure ForEachCall();` |  | For each object in the list, call a method or procedure, passing it the object.
`property Capacity: Integer; [rw]` |  | Capacity of the list
`property Count: Integer; [rw]` |  | Number of elements in the list.
`property OwnsObjects: Boolean; [rw]` |  | Should the list free elements when they are removed.
`property Items: TObject; default; [rw]` |  | Indexed access to the elements of the list.
`property List: TFPList; [r]` |  | Internal list used to keep the objects.
`end;`

## Inheritance

`TFPObjectList` |  | TFPList descendent which manages objects.
`TObject`

## Description

TFPObjectList is a TFPList based list which has as the default array property TObjects instead of pointers. By default it also manages the objects: when an object is deleted or removed from the list, it is automatically freed. This behaviour can be disabled when the list is created.

In difference with TObjectList, TFPObjectList offers no notification mechanism of list operations, allowing it to be faster than TObjectList. For the same reason, it is also not a descendent of TFPList (although it uses one internally).

## See also

#rtl.classes.TFPList
TObjectList |  | List to manage object instances.

The latest version of this document can be found at lazarus-ccr.sourceforge.net .