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

# TFPObjectHashTable.CreateWith

Create a new hash table with given size and hash function

## Declaration

Source position: contnrs.pp line 496

`public constructor TFPObjectHashTable.CreateWith(`
`AHashTableSize: LongWord;`
`aHashFunc: THashFunction;`
`AOwnsObjects: Boolean = True`
`);`

## Arguments

`AHashTableSize` |  | Hash table size
`aHashFunc` |  | Hash function to use
`AOwnsObjects` |  | Does the hash table own the objects stored in it?

## Description

CreateWith sets the OwnsObjects property to AOwnsObjects, and then calls the inherited CreateWith. If AOwnsObjects is set to True, then the hash table owns the objects: whenever an object is removed from the list, it is automatically freed.

This constructor should be used when a table size and hash algorithm should be specified that differ from the default table size and hash algorithm.

## Errors

If not enough memory is available on the heap, an exception may be raised.

## See also

TFPObjectHashTable.OwnsObjects |  | Does the hash table own the objects ?
TFPObjectHashTable.Create |  | Create a new instance of TFPObjectHashTable
TFPObjectHashTable.Items |  | Key-based access to the objects

Documentation generated on: May 14 2021