Skip to main content
Module

x/rimbu/mod.ts>SortedMap.Builder

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
interface SortedMap.Builder
implements [RMapBase.Builder]<K, V, SortedMap.Types>
import { type SortedMap } from "https://deno.land/x/rimbu@0.14.0/mod.ts";
const { Builder } = SortedMap;

A mutable SortedMap builder used to efficiently create new immutable instances. See the Map documentation and the SortedMap.Builder API documentation

Methods

min(): readonly [K, V] | undefined

Returns the entry with the minimum key of the SortedMap Builder, or a fallback value (default: undefined) if the builder is empty.

min<O>(otherwise: OptLazy<O>): readonly [K, V] | O
max(): readonly [K, V] | undefined

Returns the entry with the maximum key of the SortedMap Builder, or a fallback value (default: undefined) if the builder is empty.

max<O>(otherwise: OptLazy<O>): readonly [K, V] | O
getAtIndex(index: number): readonly [K, V] | undefined

Returns the entry with its key at the given index of the key sort order of the SortedMap builder, or a fallback value (default: undefined) if the index is out of bounds.

getAtIndex<O>(index: number, otherwise: OptLazy<O>): readonly [K, V] | O