/*! * This module defines the ListDictionary class, a data structure * that combines a linked list and a dictionary. * * Author: Jan Curn (jan@apify.com) * Copyright(c) 2015 Apify. All rights reserved. * */ import type { LinkedListNode } from './linked_list.js'; /** * The main ListDictionary class. */ export declare class ListDictionary { private linkedList; dictionary: Record>; /** * Gets the number of item in the list. */ length(): number; /** * Adds an item to the list. If there is already an item with same key, the function * returns false and doesn't make any changes. Otherwise, it returns true. */ add(key: string, item: T, toFirstPosition?: boolean): boolean; /** * Gets the first item in the list. The function returns null if the list is empty. */ getFirst(): T | null; /** * Gets the last item in the list. The function returns null if the list is empty. */ getLast(): T | null; /** * Gets the first item from the list and moves it to the end of the list. * The function returns null if the queue is empty. */ moveFirstToEnd(): T | null; /** * Removes the first item from the list. * The function returns the item or null if the list is empty. */ removeFirst(): T | null; /** * Removes the last item from the list. * The function returns the item or null if the list is empty. */ removeLast(): T | null; /** * Removes an item identified by a key. The function returns the * object if it was found or null if it wasn't. */ remove(key: string): T | null; /** * Finds a request based on the URL. */ get(key: string): T | null; /** * Removes all items from the list. */ clear(): void; }