---
title: "entries"
url: https://una-lang.org/en/docs/std/builtin/entries/
release: v0.4.0
edition: "0.2 and later"
source: https://github.com/una-lang/una/blob/v0.4.0/docs/std/builtins.json
---

# entries

A built-in method, resolved by the type of its receiver ([`spec/14 §2`](https://una-lang.org/en/docs/spec/14-standard-library/#s2)). Edition 0.2 and later.

## Edition 0.2 and later

```una
m.entries() -> List[Entry[K, V]]
  where m: Map[K, V]
```

The entries of `m` as `Entry` values, in key order, as many as `m.len` (`spec/21 §2`). On a `HashMap`, in the order the keys were first added, in O(n) (`spec/28 §7`).

## Edition 0.5 preview

```una
m.entries() -> List[Entry[K, V]]
  where m: Map[K, V]
m.entries() -> List[Entry[K, V]]
  where m: HashMap[K, V]
```

The entries of `m` as `Entry` values, in key order, as many as `m.len` (`spec/21 §2`). On a `HashMap`, in the order the keys were first added, in O(n) (`spec/28 §7`).

In editions 0.5. In edition 0.2, 0.3, 0.4: no `HashMap[K, V]` receiver\, since `std.collections` begins in edition 0\.5\: it has no `where m: HashMap[K, V]`.

## Receiver

- `Map[K, V]`: the map `m`
- `HashMap[K, V]`: the hash map `m`

## Returns

`List[Entry[K, V]]`: the entries of `m` as `Entry` values\, in ascending key order on a `Map` and in the order the keys were first added on a `HashMap`\; as many as `m.len`.

## See also

[`keys`](https://una-lang.org/en/docs/std/builtin/keys/), [`values`](https://una-lang.org/en/docs/std/builtin/values/)

## Example

`src/shop.una`

```una
module shop

--- A stock report, from the map's entries.
pub main() -> Unit
  uses @console: Console[print]
=
  let stock = empty_map().with(key: "lamp", value: 3).with(key: "desk", value: 1)
  for e in stock.entries()
    @console.print("{e.key}: {e.value}")
```

`una run .` prints:

```text
desk: 1
lamp: 3
```

## Specification

- [`spec/21 §2`](https://una-lang.org/en/docs/spec/21-maps/#s2)
- `spec/28 §7`

Generated from una v0.4.0 ([`docs/std/builtins.json`](https://github.com/una-lang/una/blob/5fec93d88932b333feec25e589355a2cb34c37b5/docs/std/builtins.json), which is not part of the specification): built-in methods have no declaration, so una writes these signature lines and tests each against its checker. The specification governs: [`spec/14 §2`](https://una-lang.org/en/docs/spec/14-standard-library/#s2).
