Home / Docs / Standard library / Built-in methods

items

Release v0.4.0Edition 0.5 preview

A built-in method, resolved by the type of its receiver (spec/14 §2). Edition 0.5 preview.

una
s.items() -> List[T]
  where s: Stack[T]
q.items() -> List[T]
  where q: Queue[T]
s.items() -> List[T]
  where s: Set[T]
s.items() -> List[T]
  where s: HashSet[T]
q.items() -> List[T]
  where q: PriorityQueue[T, P]
b.items() -> List[Int]
  where b: BitSet

The items as a list: a Stack top first and a Queue front first, as many as its len, in O(n) time (spec/28 §5); a Set's in ascending order, as many as its len, in O(n) time (spec/28 §6); a HashSet's in the order its items were first added, in O(n) time (spec/28 §7); a PriorityQueue's in the order of the pops, in O(n log n) comparisons (spec/28 §8); a BitSet's members in ascending order, in O(size / 64 + len) time (spec/28 §9).

Specification

Generated from una v0.4.0 (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.