Documentation

HashTable

Tags
template

T of IComparable

Table of Contents

$items  : array<string, T>
HashTable elements.
$keyMap  : array<int, string>
HashTable key map.
__clone()  : mixed
Implement PHP __clone to create a deep clone, not just a shallow copy.
__construct()  : mixed
Create a new HashTable.
add()  : void
Add HashTable item.
addFromSource()  : void
Add HashTable items from source.
clear()  : void
Clear HashTable.
count()  : int
Count.
getByHashCode()  : null|T
Get by hashcode.
getByIndex()  : null|T
Get by index.
getIndexForHashCode()  : false|int
Get index for hash code.
remove()  : void
Remove HashTable item.
toArray()  : array<string|int, T>
HashTable to array.

Properties

$items

HashTable elements.

protected array<string, T> $items = []

$keyMap

HashTable key map.

protected array<int, string> $keyMap = []

Methods

__clone()

Implement PHP __clone to create a deep clone, not just a shallow copy.

public __clone() : mixed
Return values
mixed

__construct()

Create a new HashTable.

public __construct([array<string|int, T$source = null ]) : mixed
Parameters
$source : array<string|int, T> = null

Optional source array to create HashTable from

Return values
mixed

add()

Add HashTable item.

public add(T $source) : void
Parameters
$source : T

Item to add

Return values
void

addFromSource()

Add HashTable items from source.

public addFromSource([array<string|int, T$source = null ]) : void
Parameters
$source : array<string|int, T> = null

Source array to create HashTable from

Return values
void

clear()

Clear HashTable.

public clear() : void
Return values
void

count()

Count.

public count() : int
Return values
int

getByHashCode()

Get by hashcode.

public getByHashCode(string $hashCode) : null|T
Parameters
$hashCode : string
Return values
null|T

getByIndex()

Get by index.

public getByIndex(int $index) : null|T
Parameters
$index : int
Return values
null|T

getIndexForHashCode()

Get index for hash code.

public getIndexForHashCode(string $hashCode) : false|int
Parameters
$hashCode : string
Return values
false|int

Index

remove()

Remove HashTable item.

public remove(T $source) : void
Parameters
$source : T

Item to remove

Return values
void

toArray()

HashTable to array.

public toArray() : array<string|int, T>
Return values
array<string|int, T>

Search results