mona-dish
    Preparing search index...

    Interface IStream<T>

    Generic interface defining a stream

    interface IStream<T> {
        value: T[];
        "[iterator]"(): Iterator<T>;
        allMatch(fn: Matchable<T>): boolean;
        anyMatch(fn: Matchable<T>): boolean;
        collect(collector: ICollector<T, any>): any;
        concat(...toAppend: IStream<T>[]): IStream<T>;
        current(): ITERATION_STATUS | T;
        each(fn: IteratableConsumer<T>): void;
        filter(fn?: Matchable<T>): IStream<T>;
        first(): Optional<T>;
        flatMap<R>(fn?: StreamMapper<T> | ArrayMapper<T>): IStream<R>;
        last(): Optional<T>;
        limits(end: number): IStream<T>;
        map<R>(fn?: Mappable<T, R>): IStream<R>;
        noneMatch(fn: Matchable<T>): boolean;
        onElem(fn: IteratableConsumer<T>): IStream<T>;
        reduce<V>(fn: Reducable<T, V>, startVal: T | V): Optional<T | V>;
        sort(comparator: Comparator<T>): IStream<T>;
    }

    Type Parameters

    • T

    Implemented by

    Index

    Properties

    value: T[]

    returns the stream collected into an array (90% use-case abbreviation

    Methods

    • returns an observable of the given stream

      Returns Iterator<T>

    • returns true if all elmements produce true on a call to fn(element)

      Parameters

      • fn: Matchable<T>

      Returns boolean

    • returns true if there is at least one element where a call fn(element) produces true

      Parameters

      • fn: Matchable<T>

      Returns boolean

    • Collect the elements with a collector given There are a number of collectors provided

      Parameters

      Returns any

    • returns the currently element selected in the stream

      Returns ITERATION_STATUS | T

    • Iterate over all elements in the stream and do some processing via fn

      Parameters

      • fn: IteratableConsumer<T>

        takes a single element and if it returns false then further processing is stopped

      Returns void

    • filtering, takes an element in and is processed by fn. If it returns false then further processing on this element is skipped if it returns true it is passed down the chain.

      Parameters

      • Optionalfn: Matchable<T>

      Returns IStream<T>

    • Takes an element in and returns a set of something the set then is flatted into a single stream to be further processed

      Type Parameters

      • R

      Parameters

      • Optionalfn: StreamMapper<T> | ArrayMapper<T>

      Returns IStream<R>

    • Returns the last stream element (note in endless streams without filtering and limiting you will never reach that point hence producing an endless loop)

      Returns Optional<T>

    • Limits the stream to a certain number of elements

      Parameters

      • end: number

        the limit of the stream

      Returns IStream<T>

    • maps a single element into another via fn

      Type Parameters

      • R

      Parameters

      • Optionalfn: Mappable<T, R>

        function which takes one element in and returns another

      Returns IStream<R>

    • returns true if no elmements produce true on a call to fn(element)

      Parameters

      • fn: Matchable<T>

      Returns boolean

    • Perform the operation fn on a single element in the stream at a time then pass the stream over for further processing This is basically an intermediate point in the stream with further processing happening later, do not use this method to gather data or iterate over all date for processing (for the second case each has to be used)

      Parameters

      • fn: IteratableConsumer<T>

        the processing function, if it returns false, further processing is stopped

      Returns IStream<T>

    • functional reduce... takes two elements in the stream and reduces to one from left to right

      Type Parameters

      • V

      Parameters

      • fn: Reducable<T, V>

        the reduction function for instance (val1,val2) => val1l+val2

      • startVal: T | V

        an optional starting value, if provided the the processing starts with this element and further goes down into the stream, if not, then the first two elements are taken as reduction starting point

      Returns Optional<T | V>

    • sort on the stream, this is a special case of an endpoint, so your data which is fed in needs to be limited otherwise it will fail it still returns a stream for further processing

      Parameters

      • comparator: Comparator<T>

      Returns IStream<T>