---
title: "intersection"
url: https://una-lang.org/en/docs/std/builtin/intersection/
release: v0.4.0
edition: "0.5 preview"
source: https://github.com/una-lang/una/blob/v0.4.0/docs/std/builtins.json
---

# intersection

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.5 preview.

```una
s.intersection(other: Set[T]) -> Set[T]
  where s: Set[T]
s.intersection(other: HashSet[T]) -> HashSet[T]
  where s: HashSet[T]
b.intersection(other: BitSet) -> BitSet
  where b: BitSet
```

The items of `s` that `other` holds. O(n + m), or less when one of the sets is much smaller (`spec/28 §6`). On a `HashSet`, in the receiver's order (`spec/28 §7`). On a `BitSet`, `other` has its size, in O(size / 64) (`spec/28 §9`).

## Specification

- `spec/28 §6`
- `spec/28 §7`
- `spec/28 §9`

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).
