import * as util from './util'; /** * Returns the position of the first occurrence of the specified item * within the specified array.4 * @param {*} array the array in which to search the element. * @param {Object} item the element to search. * @param {function(Object,Object):boolean=} equalsFunction optional function used to * check equality between 2 elements. * @return {number} the position of the first occurrence of the specified element * within the specified array, or -1 if not found. */ export declare function indexOf<T>(array: T[], item: T, equalsFunction?: util.IEqualsFunction<T>): number; /** * Returns the position of the last occurrence of the specified element * within the specified array. * @param {*} array the array in which to search the element. * @param {Object} item the element to search. * @param {function(Object,Object):boolean=} equalsFunction optional function used to * check equality between 2 elements. * @return {number} the position of the last occurrence of the specified element * within the specified array or -1 if not found. */ export declare function lastIndexOf<T>(array: T[], item: T, equalsFunction?: util.IEqualsFunction<T>): number; /** * Returns true if the specified array contains the specified element. * @param {*} array the array in which to search the element. * @param {Object} item the element to search. * @param {function(Object,Object):boolean=} equalsFunction optional function to * check equality between 2 elements. * @return {boolean} true if the specified array contains the specified element. */ export declare function contains<T>(array: T[], item: T, equalsFunction?: util.IEqualsFunction<T>): boolean; /** * Removes the first ocurrence of the specified element from the specified array. * @param {*} array the array in which to search element. * @param {Object} item the element to search. * @param {function(Object,Object):boolean=} equalsFunction optional function to * check equality between 2 elements. * @return {boolean} true if the array changed after this call. */ export declare function remove<T>(array: T[], item: T, equalsFunction?: util.IEqualsFunction<T>): boolean; /** * Returns the number of elements in the specified array equal * to the specified object. * @param {Array} array the array in which to determine the frequency of the element. * @param {Object} item the element whose frequency is to be determined. * @param {function(Object,Object):boolean=} equalsFunction optional function used to * check equality between 2 elements. * @return {number} the number of elements in the specified array * equal to the specified object. */ export declare function frequency<T>(array: T[], item: T, equalsFunction?: util.IEqualsFunction<T>): number; /** * Returns true if the two specified arrays are equal to one another. * Two arrays are considered equal if both arrays contain the same number * of elements, and all corresponding pairs of elements in the two * arrays are equal and are in the same order. * @param {Array} array1 one array to be tested for equality. * @param {Array} array2 the other array to be tested for equality. * @param {function(Object,Object):boolean=} equalsFunction optional function used to * check equality between elemements in the arrays. * @return {boolean} true if the two arrays are equal */ export declare function equals<T>(array1: T[], array2: T[], equalsFunction?: util.IEqualsFunction<T>): boolean; /** * Returns shallow a copy of the specified array. * @param {*} array the array to copy. * @return {Array} a copy of the specified array */ export declare function copy<T>(array: T[]): T[]; /** * Swaps the elements at the specified positions in the specified array. * @param {Array} array The array in which to swap elements. * @param {number} i the index of one element to be swapped. * @param {number} j the index of the other element to be swapped. * @return {boolean} true if the array is defined and the indexes are valid. */ export declare function swap<T>(array: T[], i: number, j: number): boolean; export declare function toString<T>(array: T[]): string; /** * Executes the provided function once for each element present in this array * starting from index 0 to length - 1. * @param {Array} array The array in which to iterate. * @param {function(Object):*} callback function to execute, it is * invoked with one argument: the element value, to break the iteration you can * optionally return false. */ export declare function forEach<T>(array: T[], callback: util.ILoopFunction<T>): void;