/** * A node in the @see LinkedList. */ export declare class Node { value: T; private removeCallback; /** * Next node unless last one. */ next: Node | null; /** * Previous node unless first one. */ prev: Node | null; /** * Constructor. * @param value Value contained in the node. */ constructor(value: T, removeCallback: () => void); /** * Remove this node. * Will notify the list of the update to ensure correct element count. */ remove(): void; } /** * A trivial linked list implementation. */ export declare class LinkedList { private _first; private _last; private _length; /** * Add a value to the beginning of the list. * @param value Value that should be contained in the node. */ addFirst(value: T): void; /** * Add a value to the end of the list. * @param value Value that should be contained in a node. */ addLast(value: T): void; private createNode; /** * Remove a node from the beginning of the list. * @returns Value contained in the first node. */ removeFirst(): T; /** * Remove a node from the end of the list. * @returns Value contained in the last node. */ removeLast(): T; /** * Number of nodes in the list. * * The count works as long as you do not manually remove nodes (by assigning next/prev to the neighbors). */ get length(): number; /** * First node, or `null` if the list is empty. */ get first(): Node | null; /** * Contained value of the first node, or `undefined` if the list is empty. */ get firstValue(): T | undefined; /** * Last node, or `null` if the list is empty. */ get last(): Node | null; /** * Contained value of the last node, or `undefined` if the list is empty. */ get lastValue(): T | undefined; }