pyrio.streams.stream

Classes

Stream

Abstraction over a sequence of elements supporting sequential aggregate operations

Module Contents

class pyrio.streams.stream.Stream

Bases: pyrio.streams.BaseStream, pyrio.iterators.ItertoolsMixin

Abstraction over a sequence of elements supporting sequential aggregate operations

classmethod of(*iterable)

Creates Stream from args

classmethod of_nullable(iterable)

Creates Stream from args if iterable is not None; otherwise returns empty Stream

classmethod empty()

Creates empty Stream

classmethod iterate(seed, operation, condition=None)

Creates infinite ordered Stream

classmethod generate(supplier)

Creates infinite unordered Stream with values generated by given supplier function

classmethod constant(element)

Creates infinite Stream with given value

classmethod from_range(start, stop, step=1)

Creates Stream from start (inclusive) to stop (exclusive) by an incremental step

take_nth(idx, default=None)

Returns Optional with the nth element of the stream or a default value

all_equal(key=None)

Returns True if all elements of the stream are equal to each other