Files
iterables-js/types/Vector.d.ts
2025-07-23 10:36:50 +03:00

40 lines
1.0 KiB
TypeScript

import { RandomAccessIterator } from './iterators/RandomAccess';
import { SequenceContainer } from './containers/Sequence';
export class Vector<T> extends SequenceContainer<T, VectorIterator<T>> {
/**
* empty vector
*/
constructor();
/**
* vector with n similar elements
* @param value which will be inserted
* @param n count of how many values will be inserted
*/
constructor(value: T, n?: number);
/**
* copies range of another vector
* @param begin of another SequenceContainer<T>
* @param end of another SequenceContainer<T>
*/
constructor(begin: ListIterator<T>, end: ListIterator<T>);
/**
* @returns vector[idx]
*/
get(idx: number): T;
/**
* vector[idx] = value
* @returns vector[idx]
*/
set(idx: number, value: T): T;
/**
* creates vector from array, string and other iterable object
*/
static from<T>(obj: Iterable<T>): Vector<T>;
}
export class VectorIterator<T> extends RandomAccessIterator<T> {
private constructor();
}