# Collection

Implements an hash table whose keys are string and values are `Variant`.

`NULL` is used when nothing is associated with a given key. Consequently, associating `NULL` with a key is the same thing as removing it from the collection.

The size of the internal hash table grows dynamically as data is inserted.

This class is creatable.

`DIM hCollection AS Collection hCollection = NEW Collection ( [ Mode AS Integer ] )`

Creates a new collection.

Mode is the method used for comparing keys:

- gb.Binary is a case-sensitive comparison.
- gb.Text is a case-unsensitive comparison.

This class acts like an array.

`DIM hCollection AS Collection DIM aVariant AS Variant aVariant = hCollection [ Key AS String ]`

Returns the value associated with Key.

If nothing is associated, then `NULL` is returned.

`DIM hCollection AS Collection DIM aVariant AS Variant hCollection [ Key AS String ] = aVariant`

Associates Value with _Key.

If Value is `NULL` , then the current value associated with Key is removed from the collection if it exists.

This class is enumerable with the FOR EACH keyword.

`DIM hCollection AS Collection DIM aVariant AS Variant FOR EACH aVariant IN hCollection ... NEXT`

Enumerates each value stored in the collection.

Note that elements are enumerated in the order they were inserted. But if you replace the value of an already inserted key, then the order is kept.

Properties |  | Methods |
--- | --- | --- | ---
Count Key Length |  | Add Clear Exist Remove |