Navigation:  ThinBASIC Modules > Core (thinBasic Core Engine) > DataStructures > Hash Table >

Hash_CapSet

Previous pageReturn to chapter overviewNext page

 

Description

 

Set current Hash Table container capacity.

 

Syntax

 

n = Hash_CapSet(pHash, NewCapacity)

 

Returns

 

Number, previous Hash Table container capacity.

 

Parameters

 

Name

Type

Optional

Meaning

pHash

Number

No

Handle of a Hash Table returned by Hash_New

 

Remarks

 

Hash Table capacity is the number of pre-allocated bucket. Its number is than used for hash value algorithm calculation.

It is a good choice to allocate a capacity double the number of expected key/data pairs in order to have as less as possible hash value conflicts.

 

Changing the Hash Table capacity recalculates all internal hash values of key/data pairs.

 

Restrictions

 

See also

 

Examples