import { IPredicate, IPredicateFunction } from "../predicate/IPredicate"; import { IMapper } from '../mapper/IMapper'; import { IComparator } from '../comparator/IComparator'; import { IIteratorFactory } from './IIteratorFactory'; /** * Lodash compatibility */ export interface IList { length: number; [index: number]: TItem; } export interface IEachFunction { (o: TItem, index: number): any; } export interface IArray { /** * Compatible with an array * @param predicate Predicate or function */ filter(predicate: IPredicate | IPredicateFunction): ICollection; /** * Compatible with an array * @param predicate Predicate or function */ find(predicate: IPredicate | IPredicateFunction): TItem; /** * Compatible with an array * @param callback Callback */ forEach(callback: IEachFunction): any; } export interface ICollection extends IList, IArray, Iterable, IIteratorFactory { get(index: number): TItem; add(item: TItem): ICollection; addAll(items: ICollection): ICollection; insert(position: number, item: TItem): ICollection; removeAll(): ICollection; remove(item: TItem): boolean; sort(comparator: IComparator): ICollection; iterate(callback: (item: TItem, index: number) => void, predicate?: IPredicate): any; map(mapper: IMapper): Array; getSize(): number; toArray(): Array; addArray(items: Array): ICollection; isEmpty(): boolean; }