# Module /unordered-map

Explicit hash map container (Unordered-Map) with entry iteration and key/value views.

```tangu
(use /unordered-map)
```

## Functions & symbols

### Unordered-Map

`(Unordered-Map [initial-entries]) -> Unordered-Map`

Constructs a mutable `Unordered-Map` instance.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `initial` | `Map | Array` | yes | Optional initial Map or [k v] pairs |

```tangu
(let m (Unordered-Map {:b 2 :a 1}))
```

### contains-key?

`(contains-key? map key) -> Bool`

Returns `true` if `key` exists in the map.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `map` | `Unordered-Map` | no | Map |
| `key` | `Any` | no | Key to test |

```tangu
(m/contains-key? m :b)
```

### count

`(count map) -> Int`

Alias of `count-of`: returns the entry count.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `map` | `Unordered-Map` | no | Unordered-Map instance |

```tangu
(m/count m)
```

### count-of

`(count-of map) -> Int`

Returns the number of entries currently stored.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `map` | `Unordered-Map` | no | Unordered-Map instance |

```tangu
(count-of m)
```

### entries-of

`(entries-of map) -> (Array Array)`

Returns all `[key value]` pairs as an Array.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `map` | `Unordered-Map` | no | Unordered-Map instance |

```tangu
(entries-of m)
```

### get

`(get map key [default]) -> Any`

Looks up `key` in `Unordered-Map`, returning `default` or `()` if missing.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `map` | `Unordered-Map` | no | Map |
| `key` | `Any` | no | Key to look up |
| `default` | `Any` | yes | Optional fallback when key absent |

```tangu
(m/get m :a)
```

### into-iter

`(into-iter map) -> Iter`

Returns an iterator yielding `[key value]` pairs.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `map` | `Unordered-Map` | no | Unordered-Map instance |

```tangu
(into-iter m)
```

### is-empty?

`(is-empty? map) -> Bool`

Returns `true` when the map has zero entries.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `map` | `Unordered-Map` | no | Unordered-Map instance |

```tangu
(is-empty? m)
```

### keys-of

`(keys-of map) -> Array`

Returns all keys as an Array (sorted for `Sorted-Map`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `map` | `Unordered-Map` | no | Unordered-Map instance |

```tangu
(keys-of m)
```

### put

`(put map key value) -> Unordered-Map`

Inserts or updates `key -> value` inside `Unordered-Map`.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `map` | `Unordered-Map` | no | Mutable map |
| `key` | `Any` | no | Entry key |
| `value` | `Any` | no | Entry value |

```tangu
(m/put m :c 3)
```

### remove

`(remove map key) -> Any`

Removes `key` and returns its previous value (or `()`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `map` | `Unordered-Map` | no | Mutable map |
| `key` | `Any` | no | Key to delete |

```tangu
(m/remove m :a)
```

### values-of

`(values-of map) -> Array`

Returns all values matching key order as an Array.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `map` | `Unordered-Map` | no | Unordered-Map instance |

```tangu
(values-of m)
```
