Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rimbu/list/custom/implementation/nonleaf/nonleaf-tree.ts>NonLeafTree

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
class NonLeafTree
implements Tree<T, NonLeafTree<T, C>, NonLeafBlock<T, C>, C>, NonLeaf<T>
import { NonLeafTree } from "https://deno.land/x/rimbu@1.0.0/list/custom/implementation/nonleaf/nonleaf-tree.ts";

Constructors

new
NonLeafTree(
context: ListContext,
left: NonLeafBlock<T, C>,
right: NonLeafBlock<T, C>,
middle: NonLeaf<T, NonLeafBlock<T, C>> | null,
level: number,
length?,
)

Type Parameters

T
C extends Block<T, C>

Methods

append(child: C): NonLeafTree<T, C>
concat<T2>(other: NonLeaf<T2, C>): NonLeaf<T | T2, C>
copy(
left?,
right?,
middle?,
): NonLeafTree<T, C>
copy2<T2, C2 extends Block<T2, C2>>(
left: NonLeafBlock<T2, C2>,
right: NonLeafBlock<T2, C2>,
middle: NonLeaf<T2, NonLeafBlock<T2, C2>> | null,
): NonLeafTree<T2, C2>
dropFirst(): [NonLeaf<T, C> | null, C]
dropInternal(amount: number): [NonLeaf<T, C> | null, C, number]
dropLast(): [NonLeaf<T, C> | null, C]
forEach(f: (
value: T,
index: number,
halt: () => void,
) => void
, state: TraverseState
): void
get(index: number): T
getChildLength(child: C): number
map<T2>(
mapFun: (value: T, index: number) => T2,
reversed?,
indexOffset?,
): NonLeafTree<T2, any>
mapPure<T2>(
mapFun: (value: T) => T2,
reversed?,
cacheMap?,
): NonLeafTree<T2, any>
prepend(child: C): NonLeafTree<T, C>
reversed(cacheMap?): NonLeafTree<T, C>
stream(reversed?): Stream.NonEmpty<T>
streamRange(range: IndexRange, reversed?): Stream<T>
structure(): string
takeInternal(amount: number): [NonLeaf<T, C> | null, C, number]
toArray(range?: IndexRange, reversed?): T[] | any
updateAt(index: number, update: Update<T>): NonLeafTree<T, C>