Unit 'Contnrs' Package
[Overview][Constants][Types][Classes][Procedures and functions][Index] [#fcl]


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

Hash class.


Source position: contnrs.pp line 361

type TFPCustomHashTable = class(TObject)


  constructor Create;


Instantiate a new TFPCustomHashTable instance using the default hash mechanism.

  constructor CreateWith();


Instantiate a new TFPCustomHashTable instance with given algorithm and size.

  destructor Destroy; override;


Free the hash table.

  procedure ChangeTableSize(); virtual;


Change the table size of the hash table.

  procedure Clear; virtual;


Clear the hash table.

  procedure Delete(); virtual;


Delete a key from the hash list.

  function Find();


Search for an item with a certain key value.

  function IsEmpty;


Check if the hash table is empty.

  property HashFunction: THashFunction; [rw]


Hash function currently in use.

  property Count: LongWord; [r]


Number of items in the hash table.

  property HashTableSize: LongWord; [rw]


Size of the hash table.

  property HashTable: TFPObjectList; [r]


Hash table instance.

  property VoidSlots: LongWord; [r]


Number of empty slots in the hash table.

  property LoadFactor: Double; [r]


Fraction of count versus size.

  property AVGChainLen: Double; [r]


Average chain length.

  property MaxChainLength: LongWord; [r]


Maximum chain length.

  property NumberOfCollisions: LongWord; [r]


Number of extra items.

  property Density: LongWord; [r]


Number of filled slots.





Hash class.




TFPCustomHashTable is a general-purpose hashing class. It can store string keys and pointers associated with these strings. The hash mechanism is configurable and can be optionally be specified when a new instance of the class is created; A default hash mechanism is implemented in RSHash.

The TFPHashList can also be used when fast lookup of data based on some key is required. It is slightly faster than the TFPCustomHashTable implementation, but the keys are limited to a length of 256 characters, and it is not suitable for re-use: it is a one-time fill, many times search object. TFPCustomHashTable is slower, but handles re-use better.

See also



Single item in the hash table.



TFPList descendent which manages objects.



Standard hash value calculating function.

Documentation generated on: Jul 24 2023