@mirei/ts-collections
Version:
A collection of wrappers for common data structures in TypeScript
641 lines (617 loc) • 461 kB
TypeScript
export declare abstract class AbstractCollection<TElement> extends AbstractReadonlyCollection<TElement> implements ICollection<TElement> {
protected constructor(comparator?: EqualityComparator<TElement>);
addAll<TSource extends TElement>(collection: Iterable<TSource>): boolean;
toReadonlyCollection(): IReadonlyCollection<TElement>;
abstract add(element: TElement): boolean;
abstract clear(): void;
}
declare abstract class AbstractDictionary<TKey, TValue> extends AbstractReadonlyDictionary<TKey, TValue> implements IDictionary<TKey, TValue> {
protected constructor(valueComparator: EqualityComparator<TValue>, keyValueComparator: EqualityComparator<KeyValuePair<TKey, TValue>>);
put(key: TKey, value: TValue): TValue | null;
tryAdd(key: TKey, value: TValue): boolean;
abstract add(key: TKey, value: TValue): TValue;
abstract clear(): void;
abstract remove(key: TKey): TValue | null;
abstract set(key: TKey, value: TValue): void;
}
export declare abstract class AbstractEnumerable<TElement> implements IEnumerable<TElement> {
protected readonly comparer: EqualityComparator<TElement>;
protected constructor(comparator?: EqualityComparator<TElement>);
aggregate<TAccumulate = TElement, TResult = TAccumulate>(accumulator: Accumulator<TElement, TAccumulate>, seed?: TAccumulate, resultSelector?: Selector<TAccumulate, TResult>): TAccumulate | TResult;
aggregateBy<TKey, TAccumulate = TElement>(keySelector: Selector<TElement, TKey>, seedSelector: Selector<TKey, TAccumulate> | TAccumulate, accumulator: Accumulator<TElement, TAccumulate>, keyComparator?: EqualityComparator<TKey>): IEnumerable<KeyValuePair<TKey, TAccumulate>>;
all(predicate: Predicate<TElement>): boolean;
any(predicate?: Predicate<TElement>): boolean;
append(element: TElement): IEnumerable<TElement>;
average(selector?: Selector<TElement, number>): number;
cast<TResult>(): IEnumerable<TResult>;
chunk(size: number): IEnumerable<IEnumerable<TElement>>;
combinations(size?: number): IEnumerable<IEnumerable<TElement>>;
concat(iterable: Iterable<TElement>): IEnumerable<TElement>;
contains(element: TElement, comparator?: EqualityComparator<TElement>): boolean;
count(predicate?: Predicate<TElement>): number;
countBy<TKey>(keySelector: Selector<TElement, TKey>, comparator?: EqualityComparator<TKey>): IEnumerable<KeyValuePair<TKey, number>>;
cycle(count?: number): IEnumerable<TElement>;
defaultIfEmpty(value?: TElement | null): IEnumerable<TElement | null>;
distinct(keyComparator?: EqualityComparator<TElement>): IEnumerable<TElement>;
distinctBy<TKey>(keySelector: Selector<TElement, TKey>, keyComparator?: EqualityComparator<TKey>): IEnumerable<TElement>;
elementAt(index: number): TElement;
elementAtOrDefault(index: number): TElement | null;
except(iterable: Iterable<TElement>, comparator?: EqualityComparator<TElement> | OrderComparator<TElement>): IEnumerable<TElement>;
exceptBy<TKey>(iterable: Iterable<TElement>, keySelector: Selector<TElement, TKey>, keyComparator?: EqualityComparator<TKey> | OrderComparator<TKey>): IEnumerable<TElement>;
first(predicate?: Predicate<TElement>): TElement;
firstOrDefault(predicate?: Predicate<TElement>): TElement | null;
forEach(action: IndexedAction<TElement>): void;
groupBy<TKey>(keySelector: Selector<TElement, TKey>, keyComparator?: EqualityComparator<TKey>): IEnumerable<IGroup<TKey, TElement>>;
groupJoin<TInner, TKey, TResult>(innerEnumerable: IEnumerable<TInner>, outerKeySelector: Selector<TElement, TKey>, innerKeySelector: Selector<TInner, TKey>, resultSelector: JoinSelector<TElement, IEnumerable<TInner>, TResult>, keyComparator?: EqualityComparator<TKey>): IEnumerable<TResult>;
index(): IEnumerable<[number, TElement]>;
intersect(iterable: Iterable<TElement>, comparator?: EqualityComparator<TElement> | OrderComparator<TElement>): IEnumerable<TElement>;
intersectBy<TKey>(iterable: Iterable<TElement>, keySelector: Selector<TElement, TKey>, keyComparator?: EqualityComparator<TKey> | OrderComparator<TKey>): IEnumerable<TElement>;
intersperse<TSeparator = TElement>(separator: TSeparator): IEnumerable<TElement | TSeparator>;
join<TInner, TKey, TResult>(innerEnumerable: IEnumerable<TInner>, outerKeySelector: Selector<TElement, TKey>, innerKeySelector: Selector<TInner, TKey>, resultSelector: JoinSelector<TElement, TInner, TResult>, keyComparator?: EqualityComparator<TKey>, leftJoin?: boolean): IEnumerable<TResult>;
last(predicate?: Predicate<TElement>): TElement;
lastOrDefault(predicate?: Predicate<TElement>): TElement | null;
max(selector?: Selector<TElement, number>): number;
maxBy<TKey>(keySelector: Selector<TElement, TKey>, comparator?: OrderComparator<TKey>): TElement;
min(selector?: Selector<TElement, number>): number;
minBy<TKey>(keySelector: Selector<TElement, TKey>, comparator?: OrderComparator<TKey>): TElement;
none(predicate?: Predicate<TElement>): boolean;
ofType<TResult extends ObjectType>(type: TResult): IEnumerable<InferredType<TResult>>;
orderBy<TKey>(keySelector: Selector<TElement, TKey>, comparator?: OrderComparator<TKey>): IOrderedEnumerable<TElement>;
orderByDescending<TKey>(keySelector: Selector<TElement, TKey>, comparator?: OrderComparator<TKey>): IOrderedEnumerable<TElement>;
pairwise(resultSelector: PairwiseSelector<TElement, TElement>): IEnumerable<[TElement, TElement]>;
partition(predicate: Predicate<TElement>): [IEnumerable<TElement>, IEnumerable<TElement>];
permutations(size?: number): IEnumerable<IEnumerable<TElement>>;
prepend(element: TElement): IEnumerable<TElement>;
product(selector?: Selector<TElement, number>): number;
reverse(): IEnumerable<TElement>;
scan<TAccumulate = TElement>(accumulator: Accumulator<TElement, TAccumulate>, seed?: TAccumulate): IEnumerable<TAccumulate>;
select<TResult>(selector: IndexedSelector<TElement, TResult>): IEnumerable<TResult>;
selectMany<TResult>(selector: IndexedSelector<TElement, Iterable<TResult>>): IEnumerable<TResult>;
sequenceEqual(iterable: Iterable<TElement>, comparator?: EqualityComparator<TElement>): boolean;
shuffle(): IEnumerable<TElement>;
single(predicate?: Predicate<TElement>): TElement;
singleOrDefault(predicate?: Predicate<TElement>): TElement | null;
skip(count: number): IEnumerable<TElement>;
skipLast(count: number): IEnumerable<TElement>;
skipWhile(predicate: IndexedPredicate<TElement>): IEnumerable<TElement>;
span(predicate: Predicate<TElement>): [IEnumerable<TElement>, IEnumerable<TElement>];
step(stepNumber: number): IEnumerable<TElement>;
sum(selector?: Selector<TElement, number>): number;
take(count: number): IEnumerable<TElement>;
takeLast(count: number): IEnumerable<TElement>;
takeWhile(predicate: IndexedPredicate<TElement>): IEnumerable<TElement>;
toArray(): TElement[];
toCircularLinkedList(comparator?: EqualityComparator<TElement, TElement>): CircularLinkedList<TElement>;
toDictionary<TKey, TValue>(keySelector: Selector<TElement, TKey>, valueSelector: Selector<TElement, TValue>, valueComparator?: EqualityComparator<TValue>): Dictionary<TKey, TValue>;
toEnumerableSet(): EnumerableSet<TElement>;
toImmutableDictionary<TKey, TValue>(keySelector: Selector<TElement, TKey>, valueSelector: Selector<TElement, TValue>, valueComparator?: EqualityComparator<TValue>): ImmutableDictionary<TKey, TValue>;
toImmutableList(comparator?: EqualityComparator<TElement>): ImmutableList<TElement>;
toImmutablePriorityQueue(comparator?: OrderComparator<TElement>): ImmutablePriorityQueue<TElement>;
toImmutableQueue(comparator?: EqualityComparator<TElement>): ImmutableQueue<TElement>;
toImmutableSet(): ImmutableSet<TElement>;
toImmutableSortedDictionary<TKey, TValue>(keySelector: Selector<TElement, TKey>, valueSelector: Selector<TElement, TValue>, keyComparator?: OrderComparator<TKey>, valueComparator?: EqualityComparator<TValue>): ImmutableSortedDictionary<TKey, TValue>;
toImmutableSortedSet(comparator?: OrderComparator<TElement>): ImmutableSortedSet<TElement>;
toImmutableStack(comparator?: EqualityComparator<TElement>): ImmutableStack<TElement>;
toLinkedList(comparator?: EqualityComparator<TElement>): LinkedList<TElement>;
toList(comparator?: EqualityComparator<TElement>): List<TElement>;
toLookup<TKey, TValue>(keySelector: Selector<TElement, TKey>, valueSelector: Selector<TElement, TValue>, keyComparator?: OrderComparator<TKey>): ILookup<TKey, TValue>;
toMap<TKey, TValue>(keySelector: Selector<TElement, TKey>, valueSelector: Selector<TElement, TValue>): Map<TKey, TValue>;
toObject<TKey extends string | number | symbol, TValue>(keySelector: Selector<TElement, TKey>, valueSelector: Selector<TElement, TValue>): Record<TKey, TValue>;
toPriorityQueue(comparator?: OrderComparator<TElement>): PriorityQueue<TElement>;
toQueue(comparator?: EqualityComparator<TElement>): Queue<TElement>;
toSet(): Set<TElement>;
toSortedDictionary<TKey, TValue>(keySelector: Selector<TElement, TKey>, valueSelector: Selector<TElement, TValue>, keyComparator?: OrderComparator<TKey>, valueComparator?: EqualityComparator<TValue>): SortedDictionary<TKey, TValue>;
toSortedSet(comparator?: OrderComparator<TElement>): SortedSet<TElement>;
toStack(comparator?: EqualityComparator<TElement>): Stack<TElement>;
union(iterable: Iterable<TElement>, comparator?: EqualityComparator<TElement>): IEnumerable<TElement>;
unionBy<TKey>(iterable: Iterable<TElement>, keySelector: Selector<TElement, TKey>, comparator?: EqualityComparator<TKey>): IEnumerable<TElement>;
where(predicate: IndexedPredicate<TElement>): IEnumerable<TElement>;
windows(size: number): IEnumerable<IEnumerable<TElement>>;
zip<TSecond>(iterable: Iterable<TSecond>): IEnumerable<[TElement, TSecond]>;
zip<TSecond, TResult = [TElement, TSecond]>(iterable: Iterable<TSecond>, zipper?: Zipper<TElement, TSecond, TResult>): IEnumerable<TResult>;
protected getIterableSize(iterable: Iterable<TElement>): number;
abstract [Symbol.iterator](): Iterator<TElement>;
}
export declare abstract class AbstractImmutableCollection<TElement> extends AbstractReadonlyCollection<TElement> implements IImmutableCollection<TElement> {
protected constructor(comparator?: EqualityComparator<TElement>);
abstract add(element: TElement): IImmutableCollection<TElement>;
abstract addAll<TSource extends TElement>(collection: Iterable<TSource>): IImmutableCollection<TElement>;
abstract clear(): IImmutableCollection<TElement>;
}
declare abstract class AbstractImmutableDictionary<TKey, TValue> extends AbstractReadonlyDictionary<TKey, TValue> implements IImmutableDictionary<TKey, TValue> {
protected constructor(valueComparator: EqualityComparator<TValue>, keyValueComparator: EqualityComparator<KeyValuePair<TKey, TValue>>);
abstract add(key: TKey, value: TValue): IImmutableDictionary<TKey, TValue>;
abstract clear(): IImmutableDictionary<TKey, TValue>;
abstract put(key: TKey, value: TValue): IImmutableDictionary<TKey, TValue>;
abstract remove(key: TKey): IImmutableDictionary<TKey, TValue>;
abstract set(key: TKey, value: TValue): IImmutableDictionary<TKey, TValue>;
abstract get length(): number;
}
export declare abstract class AbstractList<TElement> extends AbstractRandomAccessCollection<TElement> implements IList<TElement> {
protected constructor(comparator?: EqualityComparator<TElement>);
add(element: TElement): boolean;
contains(element: TElement, comparator?: EqualityComparator<TElement>): boolean;
elementAt(index: number): TElement;
elementAtOrDefault(index: number): TElement | null;
entries(): IterableIterator<[number, TElement]>;
first(predicate?: Predicate<TElement>): TElement;
firstOrDefault(predicate?: Predicate<TElement>): TElement | null;
indexOf(element: TElement, comparator?: EqualityComparator<TElement>): number;
last(predicate?: Predicate<TElement>): TElement;
lastIndexOf(element: TElement, comparator?: EqualityComparator<TElement>): number;
lastOrDefault(predicate?: Predicate<TElement>): TElement | null;
removeAll<TSource extends TElement>(collection: Iterable<TSource>): boolean;
removeIf(predicate: Predicate<TElement>): boolean;
abstract addAt(element: TElement, index: number): boolean;
abstract get(index: number): TElement;
abstract getRange(index: number, count: number): IList<TElement>;
abstract removeAt(index: number): TElement;
abstract set(index: number, element: TElement): TElement;
abstract sort(comparator?: OrderComparator<TElement>): void;
}
export declare abstract class AbstractRandomAccessCollection<TElement> extends AbstractCollection<TElement> implements IRandomAccessCollection<TElement> {
retainAll<TSource extends TElement>(collection: Iterable<TSource>): boolean;
abstract remove(element: TElement): boolean;
abstract removeAll<TSource extends TElement>(collection: Iterable<TSource>): boolean;
abstract removeIf(predicate: Predicate<TElement>): boolean;
}
declare abstract class AbstractRandomAccessImmutableCollection<TElement> extends AbstractImmutableCollection<TElement> implements IRandomAccessImmutableCollection<TElement> {
abstract remove(element: TElement): IRandomAccessImmutableCollection<TElement>;
abstract removeAll<TSource extends TElement>(collection: Iterable<TSource>): IRandomAccessImmutableCollection<TElement>;
abstract removeIf(predicate: (element: TElement) => boolean): IRandomAccessImmutableCollection<TElement>;
abstract retainAll<TSource extends TElement>(collection: Iterable<TSource>): IRandomAccessImmutableCollection<TElement>;
}
export declare abstract class AbstractReadonlyCollection<TElement> extends AbstractEnumerable<TElement> implements IReadonlyCollection<TElement> {
protected constructor(comparator?: EqualityComparator<TElement>);
any(predicate?: Predicate<TElement>): boolean;
containsAll<TSource extends TElement>(collection: Iterable<TSource>): boolean;
count(predicate?: Predicate<TElement>): number;
isEmpty(): boolean;
toString(): string;
toString(separator?: string): string;
toString(separator?: string, selector?: Selector<TElement, string>): string;
get comparator(): EqualityComparator<TElement> | OrderComparator<TElement>;
abstract size(): number;
abstract get length(): number;
}
declare abstract class AbstractReadonlyDictionary<TKey, TValue> implements IReadonlyDictionary<TKey, TValue> {
protected readonly keyValueComparer: EqualityComparator<KeyValuePair<TKey, TValue>>;
protected readonly valueComparer: EqualityComparator<TValue>;
protected constructor(valueComparator: EqualityComparator<TValue>, keyValueComparator: EqualityComparator<KeyValuePair<TKey, TValue>>);
aggregate<TAccumulate = KeyValuePair<TKey, TValue>, TResult = TAccumulate>(accumulator: Accumulator<KeyValuePair<TKey, TValue>, TAccumulate>, seed?: TAccumulate, resultSelector?: Selector<TAccumulate, TResult>): TAccumulate | TResult;
aggregateBy<TAggregateKey, TAccumulate = KeyValuePair<TKey, TValue>>(keySelector: Selector<KeyValuePair<TKey, TValue>, TAggregateKey>, seedSelector: Selector<TAggregateKey, TAccumulate> | TAccumulate, accumulator: Accumulator<KeyValuePair<TKey, TValue>, TAccumulate>, keyComparator?: EqualityComparator<TAggregateKey>): IEnumerable<KeyValuePair<TAggregateKey, TAccumulate>>;
all(predicate: Predicate<KeyValuePair<TKey, TValue>>): boolean;
any(predicate?: Predicate<KeyValuePair<TKey, TValue>>): boolean;
append(element: KeyValuePair<TKey, TValue>): IEnumerable<KeyValuePair<TKey, TValue>>;
asObject<TObjectKey extends string | number | symbol>(): Record<TObjectKey, TValue>;
average(selector?: Selector<KeyValuePair<TKey, TValue>, number>): number;
cast<TResult>(): IEnumerable<TResult>;
chunk(size: number): IEnumerable<IEnumerable<KeyValuePair<TKey, TValue>>>;
combinations(size?: number): IEnumerable<IEnumerable<KeyValuePair<TKey, TValue>>>;
concat(iterable: Iterable<KeyValuePair<TKey, TValue>>): IEnumerable<KeyValuePair<TKey, TValue>>;
contains(element: KeyValuePair<TKey, TValue>, comparator?: EqualityComparator<KeyValuePair<TKey, TValue>>): boolean;
count(predicate?: Predicate<KeyValuePair<TKey, TValue>>): number;
countBy<TCountKey>(keySelector: Selector<KeyValuePair<TKey, TValue>, TCountKey>, comparator?: EqualityComparator<TCountKey>): IEnumerable<KeyValuePair<TCountKey, number>>;
cycle(count?: number): IEnumerable<KeyValuePair<TKey, TValue>>;
defaultIfEmpty(value?: KeyValuePair<TKey, TValue> | null): IEnumerable<KeyValuePair<TKey, TValue> | null>;
distinct(keyComparator?: EqualityComparator<KeyValuePair<TKey, TValue>>): IEnumerable<KeyValuePair<TKey, TValue>>;
distinctBy<TDistinctKey>(keySelector: Selector<KeyValuePair<TKey, TValue>, TDistinctKey>, comparator?: EqualityComparator<TDistinctKey>): IEnumerable<KeyValuePair<TKey, TValue>>;
elementAt(index: number): KeyValuePair<TKey, TValue>;
elementAtOrDefault(index: number): KeyValuePair<TKey, TValue> | null;
except(iterable: Iterable<KeyValuePair<TKey, TValue>>, comparator?: EqualityComparator<KeyValuePair<TKey, TValue>> | OrderComparator<KeyValuePair<TKey, TValue>>): IEnumerable<KeyValuePair<TKey, TValue>>;
exceptBy<TExceptKey>(iterable: Iterable<KeyValuePair<TKey, TValue>>, keySelector: Selector<KeyValuePair<TKey, TValue>, TExceptKey>, keyComparator?: EqualityComparator<TExceptKey> | OrderComparator<TExceptKey>): IEnumerable<KeyValuePair<TKey, TValue>>;
first(predicate?: Predicate<KeyValuePair<TKey, TValue>>): KeyValuePair<TKey, TValue>;
firstOrDefault(predicate?: Predicate<KeyValuePair<TKey, TValue>>): KeyValuePair<TKey, TValue> | null;
forEach(action: IndexedAction<KeyValuePair<TKey, TValue>>): void;
groupBy<TGroupKey>(keySelector: Selector<KeyValuePair<TKey, TValue>, TGroupKey>, keyComparator?: EqualityComparator<TGroupKey>): IEnumerable<IGroup<TGroupKey, KeyValuePair<TKey, TValue>>>;
groupJoin<TInner, TGroupKey, TResult>(innerEnumerable: IEnumerable<TInner>, outerKeySelector: Selector<KeyValuePair<TKey, TValue>, TGroupKey>, innerKeySelector: Selector<TInner, TGroupKey>, resultSelector: JoinSelector<KeyValuePair<TKey, TValue>, IEnumerable<TInner>, TResult>, keyComparator?: EqualityComparator<TGroupKey>): IEnumerable<TResult>;
index(): IEnumerable<[number, KeyValuePair<TKey, TValue>]>;
intersect(iterable: Iterable<KeyValuePair<TKey, TValue>>, comparator?: EqualityComparator<KeyValuePair<TKey, TValue>> | OrderComparator<KeyValuePair<TKey, TValue>>): IEnumerable<KeyValuePair<TKey, TValue>>;
intersectBy<TIntersectKey>(iterable: Iterable<KeyValuePair<TKey, TValue>>, keySelector: Selector<KeyValuePair<TKey, TValue>, TIntersectKey>, keyComparator?: EqualityComparator<TIntersectKey> | OrderComparator<TIntersectKey>): IEnumerable<KeyValuePair<TKey, TValue>>;
intersperse<TSeparator = KeyValuePair<TKey, TValue>>(separator: TSeparator): IEnumerable<KeyValuePair<TKey, TValue> | TSeparator>;
isEmpty(): boolean;
join<TInner, TGroupKey, TResult>(innerEnumerable: IEnumerable<TInner>, outerKeySelector: Selector<KeyValuePair<TKey, TValue>, TGroupKey>, innerKeySelector: Selector<TInner, TGroupKey>, resultSelector: JoinSelector<KeyValuePair<TKey, TValue>, TInner, TResult>, keyComparator?: EqualityComparator<TGroupKey>, leftJoin?: boolean): IEnumerable<TResult>;
last(predicate?: Predicate<KeyValuePair<TKey, TValue>>): KeyValuePair<TKey, TValue>;
lastOrDefault(predicate?: Predicate<KeyValuePair<TKey, TValue>>): KeyValuePair<TKey, TValue> | null;
max(selector?: Selector<KeyValuePair<TKey, TValue>, number>): number;
maxBy<TMaxKey>(keySelector: Selector<KeyValuePair<TKey, TValue>, TMaxKey>, comparator?: OrderComparator<TMaxKey>): KeyValuePair<TKey, TValue>;
min(selector?: Selector<KeyValuePair<TKey, TValue>, number>): number;
minBy<TMinKey>(keySelector: Selector<KeyValuePair<TKey, TValue>, TMinKey>, comparator?: OrderComparator<TMinKey>): KeyValuePair<TKey, TValue>;
none(predicate?: Predicate<KeyValuePair<TKey, TValue>>): boolean;
ofType<TResult extends ObjectType>(type: TResult): IEnumerable<InferredType<TResult>>;
orderBy<TOrderKey>(keySelector: Selector<KeyValuePair<TKey, TValue>, TOrderKey>, comparator?: OrderComparator<TOrderKey>): IOrderedEnumerable<KeyValuePair<TKey, TValue>>;
orderByDescending<TOrderKey>(keySelector: Selector<KeyValuePair<TKey, TValue>, TOrderKey>, comparator?: OrderComparator<TOrderKey>): IOrderedEnumerable<KeyValuePair<TKey, TValue>>;
pairwise(resultSelector?: PairwiseSelector<KeyValuePair<TKey, TValue>, KeyValuePair<TKey, TValue>>): IEnumerable<[KeyValuePair<TKey, TValue>, KeyValuePair<TKey, TValue>]>;
partition(predicate: Predicate<KeyValuePair<TKey, TValue>>): [IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>];
permutations(size?: number): IEnumerable<IEnumerable<KeyValuePair<TKey, TValue>>>;
prepend(element: KeyValuePair<TKey, TValue>): IEnumerable<KeyValuePair<TKey, TValue>>;
product(selector?: Selector<KeyValuePair<TKey, TValue>, number>): number;
reverse(): IEnumerable<KeyValuePair<TKey, TValue>>;
scan<TAccumulate = KeyValuePair<TKey, TValue>>(accumulator: Accumulator<KeyValuePair<TKey, TValue>, TAccumulate>, seed?: TAccumulate): IEnumerable<TAccumulate>;
select<TResult>(selector: IndexedSelector<KeyValuePair<TKey, TValue>, TResult>): IEnumerable<TResult>;
selectMany<TResult>(selector: IndexedSelector<KeyValuePair<TKey, TValue>, Iterable<TResult>>): IEnumerable<TResult>;
sequenceEqual(iterable: Iterable<KeyValuePair<TKey, TValue>>, comparator?: EqualityComparator<KeyValuePair<TKey, TValue>>): boolean;
shuffle(): IEnumerable<KeyValuePair<TKey, TValue>>;
single(predicate?: Predicate<KeyValuePair<TKey, TValue>>): KeyValuePair<TKey, TValue>;
singleOrDefault(predicate?: Predicate<KeyValuePair<TKey, TValue>>): KeyValuePair<TKey, TValue> | null;
skip(count: number): IEnumerable<KeyValuePair<TKey, TValue>>;
skipLast(count: number): IEnumerable<KeyValuePair<TKey, TValue>>;
skipWhile(predicate: IndexedPredicate<KeyValuePair<TKey, TValue>>): IEnumerable<KeyValuePair<TKey, TValue>>;
span(predicate: Predicate<KeyValuePair<TKey, TValue>>): [IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>];
step(stepNumber: number): IEnumerable<KeyValuePair<TKey, TValue>>;
sum(selector?: Selector<KeyValuePair<TKey, TValue>, number>): number;
take(count: number): IEnumerable<KeyValuePair<TKey, TValue>>;
takeLast(count: number): IEnumerable<KeyValuePair<TKey, TValue>>;
takeWhile(predicate: IndexedPredicate<KeyValuePair<TKey, TValue>>): IEnumerable<KeyValuePair<TKey, TValue>>;
toArray(): KeyValuePair<TKey, TValue>[];
toCircularLinkedList(comparator?: EqualityComparator<KeyValuePair<TKey, TValue>>): CircularLinkedList<KeyValuePair<TKey, TValue>>;
toDictionary<TDictKey, TDictValue>(keySelector: Selector<KeyValuePair<TKey, TValue>, TDictKey>, valueSelector: Selector<KeyValuePair<TKey, TValue>, TDictValue>, valueComparator?: EqualityComparator<TDictValue>): Dictionary<TDictKey, TDictValue>;
toEnumerableSet(): EnumerableSet<KeyValuePair<TKey, TValue>>;
toImmutableDictionary<TDictKey, TDictValue>(keySelector: Selector<KeyValuePair<TKey, TValue>, TDictKey>, valueSelector: Selector<KeyValuePair<TKey, TValue>, TDictValue>, valueComparator?: EqualityComparator<TDictValue>): ImmutableDictionary<TDictKey, TDictValue>;
toImmutableList(comparator?: EqualityComparator<KeyValuePair<TKey, TValue>>): ImmutableList<KeyValuePair<TKey, TValue>>;
toImmutablePriorityQueue(comparator?: OrderComparator<KeyValuePair<TKey, TValue>>): ImmutablePriorityQueue<KeyValuePair<TKey, TValue>>;
toImmutableQueue(comparator?: EqualityComparator<KeyValuePair<TKey, TValue>>): ImmutableQueue<KeyValuePair<TKey, TValue>>;
toImmutableSet(): ImmutableSet<KeyValuePair<TKey, TValue>>;
toImmutableSortedDictionary<TDictKey, TDictValue>(keySelector: Selector<KeyValuePair<TKey, TValue>, TDictKey>, valueSelector: Selector<KeyValuePair<TKey, TValue>, TDictValue>, keyComparator?: OrderComparator<TDictKey>, valueComparator?: EqualityComparator<TDictValue>): ImmutableSortedDictionary<TDictKey, TDictValue>;
toImmutableSortedSet(comparator?: OrderComparator<KeyValuePair<TKey, TValue>>): ImmutableSortedSet<KeyValuePair<TKey, TValue>>;
toImmutableStack(comparator?: EqualityComparator<KeyValuePair<TKey, TValue>>): ImmutableStack<KeyValuePair<TKey, TValue>>;
toLinkedList(comparator?: EqualityComparator<KeyValuePair<TKey, TValue>>): LinkedList<KeyValuePair<TKey, TValue>>;
toList(comparator?: EqualityComparator<KeyValuePair<TKey, TValue>>): List<KeyValuePair<TKey, TValue>>;
toLookup<TLookupKey, TLookupValue>(keySelector: Selector<KeyValuePair<TKey, TValue>, TLookupKey>, valueSelector: Selector<KeyValuePair<TKey, TValue>, TLookupValue>, keyComparator?: OrderComparator<TLookupKey>): ILookup<TLookupKey, TLookupValue>;
toMap<TMapKey, TMapValue>(keySelector: Selector<KeyValuePair<TKey, TValue>, TMapKey>, valueSelector: Selector<KeyValuePair<TKey, TValue>, TMapValue>): Map<TMapKey, TMapValue>;
toObject<TObjectKey extends string | number | symbol, TObjectValue>(keySelector: Selector<KeyValuePair<TKey, TValue>, TObjectKey>, valueSelector: Selector<KeyValuePair<TKey, TValue>, TObjectValue>): Record<TObjectKey, TObjectValue>;
toPriorityQueue(comparator?: OrderComparator<KeyValuePair<TKey, TValue>>): PriorityQueue<KeyValuePair<TKey, TValue>>;
toQueue(comparator?: EqualityComparator<KeyValuePair<TKey, TValue>>): Queue<KeyValuePair<TKey, TValue>>;
toSet(): Set<KeyValuePair<TKey, TValue>>;
toSortedDictionary<TDictKey, TDictValue>(keySelector: Selector<KeyValuePair<TKey, TValue>, TDictKey>, valueSelector: Selector<KeyValuePair<TKey, TValue>, TDictValue>, keyComparator?: OrderComparator<TDictKey>, valueComparator?: EqualityComparator<TDictValue>): SortedDictionary<TDictKey, TDictValue>;
toSortedSet(comparator?: OrderComparator<KeyValuePair<TKey, TValue>>): SortedSet<KeyValuePair<TKey, TValue>>;
toStack(comparator?: EqualityComparator<KeyValuePair<TKey, TValue>>): Stack<KeyValuePair<TKey, TValue>>;
toString(): string;
toString(selector?: Selector<KeyValuePair<TKey, TValue>, string>): string;
union(iterable: Iterable<KeyValuePair<TKey, TValue>>, comparator?: EqualityComparator<KeyValuePair<TKey, TValue>>): IEnumerable<KeyValuePair<TKey, TValue>>;
unionBy<TUnionKey>(iterable: Iterable<KeyValuePair<TKey, TValue>>, keySelector: Selector<KeyValuePair<TKey, TValue>, TUnionKey>, comparator?: EqualityComparator<TUnionKey>): IEnumerable<KeyValuePair<TKey, TValue>>;
where(predicate: IndexedPredicate<KeyValuePair<TKey, TValue>>): IEnumerable<KeyValuePair<TKey, TValue>>;
windows(size: number): IEnumerable<IEnumerable<KeyValuePair<TKey, TValue>>>;
zip<TSecond, TResult = [KeyValuePair<TKey, TValue>, TSecond]>(iterable: Iterable<TSecond>, zipper?: Zipper<KeyValuePair<TKey, TValue>, TSecond, TResult>): IEnumerable<[KeyValuePair<TKey, TValue>, TSecond]> | IEnumerable<TResult>;
get keyValueComparator(): EqualityComparator<KeyValuePair<TKey, TValue>>;
get valueComparator(): EqualityComparator<TValue>;
abstract [Symbol.iterator](): Iterator<KeyValuePair<TKey, TValue>>;
abstract containsKey(key: TKey): boolean;
abstract containsValue(value: TValue, comparator?: EqualityComparator<TValue>): boolean;
abstract entries(): IterableIterator<[TKey, TValue]>;
abstract get(key: TKey): TValue | null;
abstract keys(): ISet<TKey>;
abstract size(): number;
abstract values(): ICollection<TValue>;
abstract get length(): number;
}
export declare abstract class AbstractSet<TElement> extends AbstractRandomAccessCollection<TElement> implements ISet<TElement> {
protected constructor(comparator?: EqualityComparator<TElement>);
exceptWith(other: Iterable<TElement>): void;
intersectWith(other: Iterable<TElement>): void;
isProperSubsetOf(other: Iterable<TElement>): boolean;
isProperSupersetOf(other: Iterable<TElement>): boolean;
isSubsetOf(other: Iterable<TElement>): boolean;
isSupersetOf(other: Iterable<TElement>): boolean;
overlaps(other: Iterable<TElement>): boolean;
}
export declare abstract class AbstractTree<TElement> extends AbstractRandomAccessCollection<TElement> implements ITree<TElement> {
protected readonly orderComparator: OrderComparator<TElement>;
protected root: INode<TElement> | null;
protected treeSize: number;
protected constructor(comparator?: OrderComparator<TElement>);
[Symbol.iterator](): Iterator<TElement>;
clear(): void;
contains(element: TElement, comparator?: EqualityComparator<TElement>): boolean;
find(predicate: Predicate<TElement>): TElement | null;
findBy<TKey>(key: TKey, selector: Selector<TElement, TKey>, comparator?: OrderComparator<TKey>): TElement | null;
forEach(action: IndexedAction<TElement>): void;
getRootData(): TElement | null;
isEmpty(): boolean;
remove(element: TElement): boolean;
removeBy<TKey>(key: TKey, selector: Selector<TElement, TKey>, comparator?: OrderComparator<TKey>): TElement | null;
size(): number;
toArray(): TElement[];
traverseToArray(direction?: TraverseType): TElement[];
get length(): number;
protected toInorderArray(root: INode<TElement> | null, target: TElement[]): void;
protected toPostorderArray(root: INode<TElement> | null, target: TElement[]): void;
protected toPreorderArray(root: INode<TElement> | null, target: TElement[]): void;
private containsRecursive;
private findByRecursive;
private findRecursive;
private removeByRecursive;
private toArrayRecursive;
abstract add(element: TElement): boolean;
abstract delete(element: TElement): void;
abstract insert(element: TElement): void;
abstract search(element: TElement): boolean;
}
export declare interface Accumulator<TElement, TAccumulate> {
(acc: TAccumulate, item: TElement): TAccumulate;
}
/**
* Applies an accumulator function over the sequence. If seed is specified, it is used as the initial value.
* If the resultSelector function is specified, it will be used to select the result value.
* @template TAccumulate
* @template TResult
* @param source The source iterable.
* @param accumulator The accumulator function that will be applied over the sequence.
* @param seed The value that will be used as the initial value. If not specified, the first element of the sequence will be used as the seed value.
* @param resultSelector The function that will be used to select the result value.
* @returns {TAccumulate|TResult} The final accumulator value.
* @throws {NoElementsException} If the source is empty and seed is not provided.
* @example
* const numbers = new List([1, 2, 3, 4, 5]);
* const sum = numbers.aggregate((acc, current) => acc + current); // sum = 15
* const productWithSeed = numbers.aggregate((acc, current) => acc * current, 10); // productWithSeed = 1200 (10 * 1 * 2 * 3 * 4 * 5)
* const sumAsString = numbers.aggregate(
* (acc, current) => acc + current, // Accumulator
* 0, // Seed
* (finalResult) => `Sum: ${finalResult}` // Result selector
* ); // sumAsString = "Sum: 15"
*/
export declare const aggregate: <TElement, TAccumulate = TElement, TResult = TAccumulate>(source: Iterable<TElement>, accumulator: (accumulator: TAccumulate, element: TElement) => TAccumulate, seed?: TAccumulate, resultSelector?: (accumulator: TAccumulate) => TResult) => TAccumulate | TResult;
/**
* Applies an accumulator function over the sequence, grouping the results by a key from the key selector function.
* @param source The source iterable.
* @param keySelector The key selector function that will be used to select the key for an element.
* @param seedSelector Initial accumulator value or a function that will be used to select the initial accumulator value.
* @param accumulator The accumulator function that will be applied over the sequence.
* @param keyComparator The comparator function that will be used for equality comparison of selected keys. If not provided, the default equality comparison is used.
* @example
* interface Product { category: string; price: number; }
* const products = new List<Product>([
* { category: 'Electronics', price: 700 },
* { category: 'Books', price: 120 },
* { category: 'Electronics', price: 200 },
* { category: 'Books', price: 90 }
* ]);
* const totalValuePerCategory = products.aggregateBy(
* p => p.category, // keySelector: group by category
* 0, // seedSelector: start sum at 0 for each category
* (sum, p) => sum + p.price // accumulator: add product price to sum
* ).toArray();
* // totalValuePerCategory: [{ key: 'Electronics', value: 900 }, { key: 'Books', value: 210 }]
*/
export declare const aggregateBy: <TElement, TKey, TAccumulate = TElement>(source: IEnumerable<TElement>, keySelector: Selector<TElement, TKey>, seedSelector: Selector<TKey, TAccumulate> | TAccumulate, accumulator: Accumulator<TElement, TAccumulate>, keyComparator?: EqualityComparator<TKey>) => IEnumerable<KeyValuePair<TKey, TAccumulate>>;
/**
* Determines if all elements of the sequence satisfy the specified predicate.
* @param source The source iterable.
* @param predicate The predicate function that will be used to check each element for a condition.
* @returns {boolean} true if all elements of the sequence satisfy the specified predicate; otherwise, false.
* @example
* const numbers = new List([1, 2, 3, 4, 5]);
* const allPositive = numbers.all(n => n > 0); // allPositive = true
* const allEven = numbers.all(n => n % 2 === 0); // allEven = false
*/
export declare const all: <TElement>(source: Iterable<TElement>, predicate: Predicate<TElement>) => boolean;
/**
* Determines if any element of the sequence satisfies the specified predicate.
* @param source The source iterable.
* @param predicate The predicate function that will be used to check each element for a condition.
* If not specified, it will return true if the sequence has elements, otherwise false.
* @returns {boolean} true if any element of the sequence satisfies the specified predicate; otherwise, false.
* @example
* const numbers = new List([1, 2, -3, 4, 5]);
* const hasNegative = numbers.any(n => n < 0); // hasNegative = true
* const hasGreaterThanTen = numbers.any(n => n > 10); // hasGreaterThanTen = false
* const isEmpty = new List<number>().any(); // isEmpty = false
* const isNotEmpty = numbers.any(); // isNotEmpty = true
*/
export declare const any: <TElement>(source: Iterable<TElement>, predicate?: Predicate<TElement>) => boolean;
/**
* Appends the specified element to the end of the sequence.
* @template TElement
* @param source The source iterable.
* @param element The element that will be appended to the end of the sequence
* @returns {IEnumerable<TElement>} A new enumerable sequence that ends with the specified element.
* @example
* const numbers = new List([1, 2, 3]);
* const appended = numbers.append(4).toArray(); // appended = [1, 2, 3, 4]
*/
export declare const append: <TElement>(source: Iterable<TElement>, element: TElement) => IEnumerable<TElement>;
export declare class AsyncEnumerable<TElement> implements IAsyncEnumerable<TElement> {
#private;
private readonly iterable;
constructor(iterable: AsyncIterable<TElement>);
static empty<TSource>(): IAsyncEnumerable<TSource>;
static from<TSource>(source: AsyncIterable<TSource>): IAsyncEnumerable<TSource>;
static range(start: number, count: number): IAsyncEnumerable<number>;
static repeat<TSource>(element: TSource, count: number): IAsyncEnumerable<TSource>;
[Symbol.asyncIterator](): AsyncIterator<TElement>;
aggregate<TAccumulate = TElement, TResult = TAccumulate>(accumulator: Accumulator<TElement, TAccumulate>, seed?: TAccumulate, resultSelector?: Selector<TAccumulate, TResult>): Promise<TAccumulate | TResult>;
aggregateBy<TKey, TAccumulate = TElement>(keySelector: Selector<TElement, TKey>, seedSelector: Selector<TKey, TAccumulate> | TAccumulate, accumulator: Accumulator<TElement, TAccumulate>, keyComparator?: EqualityComparator<TKey>): IAsyncEnumerable<KeyValuePair<TKey, TAccumulate>>;
all(predicate: Predicate<TElement>): Promise<boolean>;
any(predicate?: Predicate<TElement>): Promise<boolean>;
append(element: TElement): IAsyncEnumerable<TElement>;
average(selector?: Selector<TElement, number>): Promise<number>;
cast<TResult>(): IAsyncEnumerable<TResult>;
chunk(count: number): IAsyncEnumerable<IEnumerable<TElement>>;
combinations(size?: number): IAsyncEnumerable<IEnumerable<TElement>>;
concat(other: AsyncIterable<TElement>): IAsyncEnumerable<TElement>;
contains(element: TElement, comparator?: EqualityComparator<TElement>): Promise<boolean>;
count(predicate?: Predicate<TElement>): Promise<number>;
countBy<TKey>(keySelector: Selector<TElement, TKey>, comparator?: EqualityComparator<TKey>): IAsyncEnumerable<KeyValuePair<TKey, number>>;
cycle(count?: number): IAsyncEnumerable<TElement>;
defaultIfEmpty(defaultValue?: TElement | null): IAsyncEnumerable<TElement | null>;
distinct(keyComparator?: EqualityComparator<TElement>): IAsyncEnumerable<TElement>;
distinctBy<TKey>(keySelector: Selector<TElement, TKey>, keyComparator?: EqualityComparator<TKey>): IAsyncEnumerable<TElement>;
elementAt(index: number): Promise<TElement>;
elementAtOrDefault(index: number): Promise<TElement | null>;
except(iterable: AsyncIterable<TElement>, comparator?: EqualityComparator<TElement> | OrderComparator<TElement>): IAsyncEnumerable<TElement>;
exceptBy<TKey>(enumerable: AsyncIterable<TElement>, keySelector: Selector<TElement, TKey>, comparator?: EqualityComparator<TKey> | OrderComparator<TKey>): IAsyncEnumerable<TElement>;
first(predicate?: Predicate<TElement>): Promise<TElement>;
firstOrDefault(predicate?: Predicate<TElement>): Promise<TElement | null>;
forEach(action: IndexedAction<TElement>): Promise<void>;
groupBy<TKey>(keySelector: Selector<TElement, TKey>, keyComparator?: EqualityComparator<TKey>): IAsyncEnumerable<IGroup<TKey, TElement>>;
groupJoin<TInner, TKey, TResult>(inner: IAsyncEnumerable<TInner>, outerKeySelector: Selector<TElement, TKey>, innerKeySelector: Selector<TInner, TKey>, resultSelector: JoinSelector<TElement, IEnumerable<TInner>, TResult>, keyComparator?: EqualityComparator<TKey>): IAsyncEnumerable<TResult>;
index(): IAsyncEnumerable<[number, TElement]>;
intersect(iterable: AsyncIterable<TElement>, comparator?: EqualityComparator<TElement> | OrderComparator<TElement>): IAsyncEnumerable<TElement>;
intersectBy<TKey>(enumerable: AsyncIterable<TElement>, keySelector: Selector<TElement, TKey>, comparator?: EqualityComparator<TKey> | OrderComparator<TKey>): IAsyncEnumerable<TElement>;
intersperse<TSeparator = TElement>(separator: TSeparator): IAsyncEnumerable<TElement | TSeparator>;
join<TInner, TKey, TResult>(inner: IAsyncEnumerable<TInner>, outerKeySelector: Selector<TElement, TKey>, innerKeySelector: Selector<TInner, TKey>, resultSelector: JoinSelector<TElement, TInner, TResult>, keyComparator?: EqualityComparator<TKey>, leftJoin?: boolean): IAsyncEnumerable<TResult>;
last(predicate?: Predicate<TElement>): Promise<TElement>;
lastOrDefault(predicate?: Predicate<TElement>): Promise<TElement | null>;
max(selector?: Selector<TElement, number>): Promise<number>;
maxBy<TKey>(keySelector: Selector<TElement, TKey>, comparator?: OrderComparator<TKey>): Promise<TElement>;
min(selector?: Selector<TElement, number>): Promise<number>;
minBy<TKey>(keySelector: Selector<TElement, TKey>, comparator?: OrderComparator<TKey>): Promise<TElement>;
none(predicate?: Predicate<TElement>): Promise<boolean>;
ofType<TResult extends ObjectType>(type: TResult): IAsyncEnumerable<InferredType<TResult>>;
orderBy<TKey>(keySelector: Selector<TElement, TKey>, comparator?: OrderComparator<TKey>): IOrderedAsyncEnumerable<TElement>;
orderByDescending<TKey>(keySelector: Selector<TElement, TKey>, comparator?: OrderComparator<TKey>): IOrderedAsyncEnumerable<TElement>;
pairwise(resultSelector: PairwiseSelector<TElement, TElement>): IAsyncEnumerable<[TElement, TElement]>;
partition(predicate: Predicate<TElement>): Promise<[IEnumerable<TElement>, IEnumerable<TElement>]>;
permutations(size?: number): IAsyncEnumerable<IEnumerable<TElement>>;
prepend(element: TElement): IAsyncEnumerable<TElement>;
product(selector?: Selector<TElement, number>): Promise<number>;
reverse(): IAsyncEnumerable<TElement>;
scan<TAccumulate = TElement>(accumulator: Accumulator<TElement, TAccumulate>, seed?: TAccumulate): IAsyncEnumerable<TAccumulate>;
select<TResult>(selector: IndexedSelector<TElement, TResult>): IAsyncEnumerable<TResult>;
selectMany<TResult>(selector: IndexedSelector<TElement, Iterable<TResult>>): IAsyncEnumerable<TResult>;
sequenceEqual(iterable: AsyncIterable<TElement>, comparator?: EqualityComparator<TElement>): Promise<boolean>;
shuffle(): IAsyncEnumerable<TElement>;
single(predicate?: Predicate<TElement>): Promise<TElement>;
singleOrDefault(predicate?: Predicate<TElement>): Promise<TElement | null>;
skip(count: number): IAsyncEnumerable<TElement>;
skipLast(count: number): IAsyncEnumerable<TElement>;
skipWhile(predicate: IndexedPredicate<TElement>): IAsyncEnumerable<TElement>;
span(predicate: Predicate<TElement>): Promise<[IEnumerable<TElement>, IEnumerable<TElement>]>;
step(step: number): IAsyncEnumerable<TElement>;
sum(selector?: Selector<TElement, number>): Promise<number>;
take(count: number): IAsyncEnumerable<TElement>;
takeLast(count: number): IAsyncEnumerable<TElement>;
takeWhile(predicate: IndexedPredicate<TElement>): IAsyncEnumerable<TElement>;
toArray(): Promise<TElement[]>;
toObject<TKey extends string | number | symbol, TValue>(keySelector: Selector<TElement, TKey>, valueSelector: Selector<TElement, TValue>): Promise<Record<TKey, TValue>>;
union(iterable: AsyncIterable<TElement>, comparator?: EqualityComparator<TElement>): IAsyncEnumerable<TElement>;
unionBy<TKey>(enumerable: AsyncIterable<TElement>, keySelector: Selector<TElement, TKey>, comparator?: EqualityComparator<TKey>): IAsyncEnumerable<TElement>;
where(predicate: IndexedPredicate<TElement>): IAsyncEnumerable<TElement>;
windows(size: number): IAsyncEnumerable<IEnumerable<TElement>>;
zip<TSecond>(iterable: AsyncIterable<TSecond>): IAsyncEnumerable<[TElement, TSecond]>;
zip<TSecond, TResult = [TElement, TSecond]>(iterable: AsyncIterable<TSecond>, zipper: Zipper<TElement, TSecond, TResult>): IAsyncEnumerable<TResult>;
}
/**
* Computes the average of the sequence. The sequence should be either a sequence consisting of numbers, or an appropriate selector function should be provided.
* @param source The source iterable.
* @param selector The selector function that will select a numeric value from the sequence elements.
* @returns {number} The average of the sequence.
* @throws {NoElementsException} If the source is empty.
* @example
* const numbers = new List([1, 2, 3, 4, 5]);
* const avg = numbers.average(); // avg = 3
*
* interface Item { value: number; }
* const items = new List<Item>([{ value: 10 }, { value: 20 }, { value: 60 }]);
* const avgValue = items.average(item => item.value); // avgValue = 30
*/
export declare const average: <TElement>(source: Iterable<TElement>, selector?: Selector<TElement, number>) => number;
declare type BigIntType = bigint | BigInt | BigIntConstructor | "bigint";
declare type BooleanType = boolean | Boolean | BooleanConstructor | "boolean";
/**
* Casts the elements of the sequence to the specified type.
* @template TResult
* @param source The source iterable.
* @returns {IEnumerable<TResult>} A new enumerable sequence whose elements are of the specified type.
* @example
* const mixedList = new List([1, 'two', 3, 'four', 5]);
* const numbersOnly = mixedList
* .where(item => typeof item === 'number')
* .cast<number>();
* // numbersOnly = [1, 3, 5]
*
* // Note: Cast doesn't perform type conversion, only type assertion.
* // If an element cannot be cast, it may lead to runtime errors later.
* // Example of a potential issue (if not pre-filtered):
* // const potentialError = mixedList.cast<number>();
* // Iterating potentialError might throw errors when 'two' or 'four' are accessed as numbers.
*/
export declare const cast: <TResult, TElement = unknown>(source: Iterable<TElement>) => IEnumerable<TResult>;
/**
* Splits the elements of the sequence into chunks of size at most the specified size.
* @template TElement
* @param source The source iterable.
* @param size The maximum size of each chunk.
* @return {IEnumerable<IEnumerable<TElement>>} A new enumerable sequence whose elements are chunks of the original sequence.
* @throws {InvalidArgumentException} If size is less than or equal to 0.
* @example
* const numbers = new List([1, 2, 3, 4, 5, 6, 7, 8]);
* const chunks = numbers.chunk(3).select(chunk => chunk.toArray()).toArray();
* // chunks = [[1, 2, 3], [4, 5, 6], [7, 8]]
*/
export declare const chunk: <TElement>(source: Iterable<TElement>, size: number) => IEnumerable<IEnumerable<TElement>>;
/**
* Represents a circular doubly linked list.
* In a circular linked list, the last node points to the first node (head.prev -> tail),
* and the first node points to the last node (tail.next -> head), forming a circle.
* This implementation uses a single 'head' reference, where head.prev gives the tail.
*/
export declare class CircularLinkedList<TElement> extends AbstractList<TElement> {
#private;
/**
* Initializes a new instance of the CircularLinkedList class.
* @param iterable An optional iterable to populate the list with.
* @param comparator An optional equality comparator for elements.
*/
constructor(iterable?: Iterable<TElement>, comparator?: EqualityComparator<TElement>);
/**
* Gets an iterator for the circular linked list.
* Iterates through the list starting from the head node.
* @returns {Iterator<TElement>} An iterator for the list.
*/
[Symbol.iterator](): Iterator<TElement>;
/**
* Adds an element to the end of the list.
* @param element The element to add.
* @returns {boolean} Always returns true as the add operation succeeds.
*/
add(element: TElement): boolean;
/**
* Adds an element at the specified index in the list.
* @param element The element to add.
* @param index The zero-based index at which the element should be inserted.
* @returns {boolean} Always returns true as the add operation succeeds.
* @throws {IndexOutOfBoundsException} If the index is out of range (index < 0 or index > size).
*/
addAt(element: TElement, index: number): boolean;
/**
* Adds an element to the beginning of the list.
* @param element The element to add.
*/
addFirst(element: TElement): void;
/**
* Adds an element to the end of the list.
* @param element The element to add.
*/
addLast(element: TElement): void;
/**
* Removes all elements from the list.
*/
clear(): void;
/**
* Determines whether the list contains a specific element.
* @param element The element to locate.
* @param comparator An optional equality comparator.
* @returns {boolean} True if the element is found; otherwise, false.
*/
contains(element: TElement, comparator?: EqualityComparator<TElement>): boolean;
/**
* Gets the element at the specified zero-based index.
* @param index The index of the element to retrieve.
* @returns {TElement} The element at the specified index.
* @throws {IndexOutOfBoundsException} If the index is out of range (index < 0 or index >= size).
*/
get(index: number): TElement;
/**
* Gets a range of elements starting from the specified index.
* The range wraps around the list if necessary.
* @param index The zero-based starting index of the range.
* @param count The number of elements in the range.
* @returns {CircularLinkedList<TElement>} A new CircularLinkedList containing the specified range.
* @throws {IndexOutOfBoundsException} If the index is out of range (index < 0 or index >= size, or index > 0 for an empty list).
* @throws {InvalidArgumentException} If count is negative.
*/
getRange(index: number, count: number): CircularLinkedList<TElement>;
/**
* Removes the fir