export declare class List { private _itemIds; private _size; items: T[]; constructor(); addOne(item: T, guid?: string): void; /** * Adds an item (or multiple item arguments) to the * list. * * NOTE: this list enforces unique items - if the item * already exists in the list, it will be overwritten. * * @param {T[]} ...itemArgs The item(s) to add */ add(...itemArgs: T[]): void; /** * Removes the given item from the list and * returns that item * @param {T} item The item to remove * @return {T} The removed item */ remove(item: T): T; /** * Removes each item from the array, starting from the end, * and passes the item into the provided callback, once * for each item. * @param {Function} callback A callback function to execute over each removed item */ removeEach(callback: Function): void; /** * Removes the first item in the list * @return {T} the removed item */ removeFirst(): T; /** * Removes the item at the given index * @param {number} index index at which to remove the item * @return {T} the removed item */ removeAtIndex(index: number): T; /** * Replaces the item in the list at the given index. * If there is no item at that index, nothing happens. * @param {T} item The item to replace * @return {T} The item replaced */ replaceAtIndex(item: T, index: number): T; /** * Returns the first element in the list * @return {T} the first element */ first(): T; /** * Returns the last element in the list * @return {T} The last element */ last(): T; /** * Gets the given item from the list * @param {T} item The item to get * @return {T} The item, if it exists in the list */ get(guid: string): T; /** * Returns the index of the given item, if it exists, * otherwise -1. * @param {T} item The item to search for * @return {number} The item index */ indexOf(item: T): number; /** * Returns whether the given item exists in the list * @param {T} item the item to search for * @return {boolean} true if the item exists, otherwise false */ contains(item: T): boolean; /** * The size of the list * @return {number} Size of the list */ size(): number; /** * Returns whether the list has any elements * @return {boolean} true if the list has elements, otherwise false */ hasElements(): boolean; /** * Returns whether the list has an element at the given index * @param {number} index the index to check * @return {boolean} true if there is an element, otherwise false */ hasElementAtIndex(index: number): boolean; /** * Returns whether the list is empty * @return {boolean} true if the list is empty, otherwise false */ isEmpty(): boolean; /** * Empties the entire list * @return {T[]} Returns the list of items */ empty(): T[]; /** * Concatenates the given list items on to this list's array of items. * Optionally, you can pass in a predicate function to run to prevent * certain items from being concatenated if the predicate function returns * falsy. * @param {List} The list to add to this current list * @param {Function} An optional condition function which determines which elements get ignored * @return {List} Returns the concatenated list */ concat(list: List, ignoreConditionPredicate?: Function): List; /** * Iterates over the list of items and calls the given * function for each item, receiving the current item and its index * @param {Function} predicate The function to call */ forEach(predicate: Function): void; /** * Filters the list by the return function defined * in the given function, returning an array of items * for which the given test is true * @param {Function} predicate The test function * @return {T[]} a list of items that meet the given criteria */ filter(predicate: Function): T[]; /** * Filters the items (see the `filter` method) and returns the * first result. * @param {Function} predicate the test function * @return {T} the first result */ filterFirst(predicate: Function): T; /** * Returns this list as an array literal. * @return {T[]} The array of items */ toJson(): T[]; /** * Return the array of items. * @return {T[]} [description] */ toArray(): T[]; /** * Populates this list with the items in the given array * literal. * @param {T[]} items The array of items to populate this list with * @param {T} clone @TODO */ fromJson(items: T[], clone?: T): void; }