@tsdotnet/collection-base - v2.1.1
    Preparing search index...

    Interface ReadOnlyCollection<T>

    Interface for implementing a finite read-only collection.

    interface ReadOnlyCollection<T> {
        count: number;
        get version(): number;
        "[iterator]"(): Iterator<T>;
        assertVersion(version: number): true;
        contains(entry: T): boolean;
        copyTo<TTarget extends ArrayLikeWritable<T>>(
            target: TTarget,
            index?: number,
        ): TTarget;
        filter(predicate: PredicateWithIndex<T>): ExtendedIterable<T>;
        getCount(): number;
        incrementVersion(): number;
        map<TResult>(
            selector: SelectorWithIndex<T, TResult>,
        ): ExtendedIterable<TResult>;
        reduce<T>(reduction: (previous: T, current: T, index: number) => T): T;
        reduce<T, U>(
            reduction: (previous: U, current: T, index: number) => U,
            initialValue: U,
        ): U;
        toArray(): T[];
    }

    Type Parameters

    • T

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    count: number

    Accessors

    • get version(): number

      The version number used to track changes.

      Returns number

    Methods

    • Applies a reducer function to all the elements in this sequence. The first entry is used as the initial accumulator value, and the specified function is used to select the result value.

      Type Parameters

      • T

      Parameters

      • reduction: (previous: T, current: T, index: number) => T

      Returns T

      If the sequence is empty.

    • Applies a reducer function to all the elements in this sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.

      Type Parameters

      • T
      • U

      Parameters

      • reduction: (previous: U, current: T, index: number) => U
      • initialValue: U

      Returns U