returns the stream collected into an array (90% use-case abbreviation
Collect the elements with a collector given There are a number of collectors provided
concat for streams, so that you can concat two streams together
Rest
...toAppend: IStream<T>[]Iterate over all elements in the stream and do some processing via fn
takes a single element and if it returns false then further processing is stopped
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.
Takes an element in and returns a set of something the set then is flatted into a single stream to be further processed
Limits the stream to a certain number of elements
the limit of the stream
looks ahead cnt without changing the internal data "pointers" of the data source (this is mostly needed by possibly infinite constructs like lazy streams, because they do not know by definition their boundaries)
either the element or ITERATION_STATUS.EO_STRM if we hit the end of the stream before finding the "cnt" element
the elements to look ahead
maps a single element into another via fn
function which takes one element in and returns another
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)
the processing function, if it returns false, further processing is stopped
functional reduce... takes two elements in the stream and reduces to one from left to right
the reduction function for instance (val1,val2) => val1l+val2
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
Static
ofRest
...values: T[]Static
ofStatic
ofStatic
ofStatic
ofGenerated using TypeDoc
Lazy implementation of a Stream The idea is to connect the intermediate streams as datasources like a linked list with reverse referencing and for special operations like filtering flatmapping have intermediate datasources in the list with specialized functions.
Sort of a modified pipe valve pattern the streams are the pipes the intermediate data sources are the valves
We then can use passed in functions to control the flow in the valves
That way we can have a lazy evaluating stream
So if an endpoint requests data a callback trace goes back the stream list which triggers an operation upwards which sends data down the drain which then is processed and filtered until one element hits the endpoint.
That is repeated, until all elements are processed or an internal limit is hit.