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

# TFPHashList

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

Hash list class for pointer data

## Declaration

Source position: contnrs.pp line 212

`type TFPHashList = class(TObject)`
`public`
`constructor Create;` |  | Create a new instance of the hashlist
`destructor Destroy; override;` |  | Removes an instance of the hashlist from the heap
`function Add();` |  | Add a new key/data pair to the list
`procedure Clear;` |  | Clear the list
`function NameOfIndex();` |  | Returns the key name of an item by index
`function HashOfIndex();` |  | Return the hash value of an item by index
`function GetNextCollision();` |  | Get next collision number
`procedure Delete();` |  | Delete an item from the list.
`class procedure Error();` |  | Raise an error
`function Expand;` |  | Expand the list
`function Extract();` |  | Extract a pointer from the list
`function IndexOf();` |  | Return the index of the data pointer
`function Find();` |  | Find data associated with key
`function FindIndexOf();` |  | Return index of named item.
`function FindWithHash();` |  | Find first element with given name and hash value
`function Rename();` |  | Rename a key
`function Remove();` |  | Remove first instance of a pointer
`procedure Pack;` |  | Remove nil pointers from the list
`procedure ShowStatistics;` |  | Return some statistics for the list.
`procedure ForEachCall();` |  | Call a procedure for each element in the list
`property Capacity: Integer; [rw]` |  | Capacity of the list.
`property Count: Integer; [rw]` |  | Current number of elements in the list.
`property Items []: Pointer; default; [rw]` |  | Indexed array with pointers
`property List: PHashItemList; [r]` |  | Low-level hash list
`property Strs: PChar; [r]` |  | Low-level memory area with strings.
`end;`

## Inheritance

`TFPHashList` |  | Hash list class for pointer data
`TObject`

## Description

TFPHashList implements a fast hash class. The class is built for speed, therefore the key values can be shortstrings only, and the data can only be non-nil pointers.

if a base class for an own hash class is wanted, the TFPCustomHashTable class can be used. If a hash class for objects is needed instead of pointers, the TFPHashObjectList class can be used.

## See also

TFPCustomHashTable |  | Hash class
TFPHashObjectList
TFPDataHashTable |  | Hash table for data pointers
TFPStringHashTable |  | Hash table for string data.