UNPKG

@barchart/common-js

Version:
51 lines (50 loc) 1.16 kB
/** * A singly linked list. Each instance represents a node in the list, * holding both an item, a reference to the next node. * * @public */ export default class LinkedList { /** * @param {*} value - The value of current node. */ constructor(value: any); /** * Returns the value associated with the current node. * * @public * @returns {*} */ public getValue(): any; /** * Returns the next node, if it exists; otherwise a null value is returned. * * @public * @returns {LinkedList|null} */ public getNext(): LinkedList | null; /** * Returns true, if the node is the last one in the list. * * @public * @returns {boolean} */ public getIsTail(): boolean; /** * Adds (or inserts) a value after the current node and returns * the newly added node. * * @public * @param {*} value * @returns {LinkedList} */ public insert(value: any): LinkedList; /** * Returns a string representation. * * @public * @returns {string} */ public toString(): string; #private; }