Concatenates the source Observable with the other Observable, as specified.
Concatenates the source Observable with the other Observable, as specified.
Creates a new Observable that emits the given elements and then it also emits the events of the source (prepend operation).
Creates a new Observable that emits the given elements and then it also emits the events of the source (prepend operation).
Creates a new Observable that emits the events of the source and then it also emits the given elements (appended to the stream).
Creates a new Observable that emits the events of the source and then it also emits the given elements (appended to the stream).
Returns the first generated result as a Future and then cancels the subscription.
Returns the first generated result as a Future and then cancels the subscription.
Converts this observable into a multicast observable, useful for turning a cold observable into a hot one (i.
Converts this observable into a multicast observable, useful for turning a cold observable into a hot one (i.e. whose source is shared by all observers). The underlying subject used is a BehaviorSubject.
Wraps the observer implementation given to subscribeFn
into a
BufferedObserver.
Wraps the observer implementation given to subscribeFn
into a
BufferedObserver.
Normally Monifu's implementation guarantees that events are not emitted concurrently,
and that the publisher MUST NOT emit the next event without acknowledgement from the consumer
that it may proceed, however for badly behaved publishers, this wrapper provides
the guarantee that the downstream Observer given in subscribe
will not receive
concurrent events.
Compared with concurrent / ConcurrentObserver, the acknowledgement
given by BufferedObserver is synchronous
(i.e. the Future[Ack]
is already completed), so the publisher can send the next event without waiting for
the final consumer to receive and process the previous event (i.e. the data source will receive the Continue
acknowledgement once the event has been buffered, not when it has been received by its final destination).
WARNING: if the buffer created by this operator is unbounded, it can blow up the process if the data source is pushing events faster than what the observer can consume, as it introduces an asynchronous boundary that eliminates the back-pressure requirements of the data source. Unbounded is the default policy, see BufferPolicy for options.
Returns an Observable that doesn't emit anything, but that completes when the source Observable completes.
Returns an Observable that doesn't emit anything, but that completes when the source Observable completes.
Concatenates the sequence of Observables emitted by the source into one Observable, without any transformation.
Concatenates the sequence of Observables emitted by the source into one Observable, without any transformation.
You can combine the items emitted by multiple Observables so that they act like a single Observable by using this method.
The difference between concat and merge is
that concat
cares about ordering of emitted items (e.g. all items emitted by the first observable
in the sequence will come before the elements emitted by the second observable), whereas merge
doesn't care about that (elements get emitted as they come). Because of back-pressure applied to observables,
concat is safe to use in all contexts, whereas merge requires buffering.
an Observable that emits items that are the result of flattening the items emitted
by the Observables emitted by this
Creates a new Observable by applying a function that you supply to each item emitted by the source Observable, where that function returns an Observable, and then concatenating those resulting Observables and emitting the results of this concatenation.
Creates a new Observable by applying a function that you supply to each item emitted by the source Observable, where that function returns an Observable, and then concatenating those resulting Observables and emitting the results of this concatenation.
a function that, when applied to an item emitted by the source Observable, returns an Observable
an Observable that emits the result of applying the transformation function to each item emitted by the source Observable and concatenating the results of the Observables obtained from this transformation.
Wraps the observer implementation given to subscribeFn
into a
ConcurrentObserver.
Wraps the observer implementation given to subscribeFn
into a
ConcurrentObserver.
Normally Monifu's implementation guarantees that events are not emitted concurrently,
and that the publisher MUST NOT emit the next event without acknowledgement from the consumer
that it may proceed, however for badly behaved publishers, this wrapper provides
the guarantee that the downstream Observer given in subscribe
will not receive
concurrent events, also making it thread-safe.
WARNING: the buffer created by this operator is unbounded and can blow up the process if the data source is pushing events without following the back-pressure requirements and faster than what the destination consumer can consume. On the other hand, if the data-source does follow the back-pressure contract, than this is safe. For data sources that cannot respect the back-pressure requirements and are problematic, see buffered and BufferPolicy for options.
Given a function that returns a key for each element emitted by the source Observable, suppress duplicates items.
Given a function that returns a key for each element emitted by the source Observable, suppress duplicates items.
WARNING: this requires unbounded buffering.
Suppress the duplicate elements emitted by the source Observable.
Suppress the duplicate elements emitted by the source Observable.
WARNING: this requires unbounded buffering.
Suppress duplicate consecutive items emitted by the source Observable
Suppress duplicate consecutive items emitted by the source Observable
Suppress duplicate consecutive items emitted by the source Observable
Suppress duplicate consecutive items emitted by the source Observable
Executes the given callback when the stream has ended on onComplete
(after the event was already emitted)
Executes the given callback when the stream has ended on onComplete
(after the event was already emitted)
NOTE: protect the callback such that it doesn't throw exceptions, because
it gets executed after onComplete()
happens and by definition the error cannot
be streamed with onError()
.
the callback to execute when the subscription is canceled
Executes the given callback for each element generated by the source Observable, useful for doing side-effects.
Executes the given callback for each element generated by the source Observable, useful for doing side-effects.
a new Observable that executes the specified callback for each element
Drops the first n elements (from the start).
Drops the first n elements (from the start).
the number of elements to drop
a new Observable that drops the first n elements emitted by the source
Drops the longest prefix of elements that satisfy the given predicate and returns a new Observable that emits the rest.
Drops the longest prefix of elements that satisfy the given predicate and returns a new Observable that emits the rest.
Utility that can be used for debugging purposes.
Utility that can be used for debugging purposes.
Creates a new Observable that emits the events of the source and then it also emits the given elements (appended to the stream).
Creates a new Observable that emits the events of the source and then it also emits the given elements (appended to the stream).
Emits the given exception instead of onComplete
.
Emits the given exception instead of onComplete
.
the exception to emit onComplete
a new Observable that emits an exception onComplete
Returns an Observable that emits a single Throwable, in case an error was thrown by the source Observable, otherwise it isn't going to emit anything.
Returns an Observable that emits a single Throwable, in case an error was thrown by the source Observable, otherwise it isn't going to emit anything.
Returns an Observable which emits a single value, either true, in case the given predicate holds for at least one item, or false otherwise.
Returns an Observable which emits a single value, either true, in case the given predicate holds for at least one item, or false otherwise.
a function that evaluates the items emitted by the source Observable, returning true
if they pass the filter
an Observable that emits only true or false in case the given predicate holds or not for at least one item
Returns an Observable which only emits those items for which the given predicate holds.
Returns an Observable which only emits those items for which the given predicate holds.
a function that evaluates the items emitted by the source Observable, returning true
if they pass the filter
an Observable that emits only those items in the original Observable for which the filter evaluates as true
Returns an Observable which only emits the first item for which the predicate holds.
Returns an Observable which only emits the first item for which the predicate holds.
a function that evaluates the items emitted by the source Observable, returning true
if they pass the filter
an Observable that emits only the first item in the original Observable for which the filter evaluates as true
Emits the first element emitted by the source, or otherwise if the source is completed without
emitting anything, then the default
is emitted.
Emits the first element emitted by the source, or otherwise if the source is completed without
emitting anything, then the default
is emitted.
Alias for headOrElse
.
Creates a new Observable by applying a function that you supply to each item emitted by the source Observable, where that function returns an Observable, and then concatenating those resulting Observables and emitting the results of this concatenation.
Creates a new Observable by applying a function that you supply to each item emitted by the source Observable, where that function returns an Observable, and then concatenating those resulting Observables and emitting the results of this concatenation.
a function that, when applied to an item emitted by the source Observable, returns an Observable
an Observable that emits the result of applying the transformation function to each item emitted by the source Observable and concatenating the results of the Observables obtained from this transformation.
Given a start value (a seed) and a function taking the current state
(starting with the seed) and the currently emitted item and returning a new
state value as a Future
, it returns a new Observable that applies the given
function to all emitted items, emitting the produced state along the way.
Given a start value (a seed) and a function taking the current state
(starting with the seed) and the currently emitted item and returning a new
state value as a Future
, it returns a new Observable that applies the given
function to all emitted items, emitting the produced state along the way.
This operator is to scan what flatMap is to map.
Example:
// dumb long running function, returning a Future result def sumUp(x: Long, y: Int) = Future(x + y) Observable.range(0, 10).flatScan(0L)(sumUp).dump("FlatScan").subscribe() //=> 0: FlatScan-->0 //=> 1: FlatScan-->1 //=> 2: FlatScan-->3 //=> 3: FlatScan-->6 //=> 4: FlatScan-->10 //=> 5: FlatScan-->15 //=> 6: FlatScan-->21 //=> 7: FlatScan-->28 //=> 8: FlatScan-->36 //=> 9: FlatScan-->45 //=> 10: FlatScan completed
NOTE that it does back-pressure and the state produced by this function is emitted in order of the original input. This is the equivalent of concatMap and NOT mergeMap (a mergeScan wouldn't make sense anyway).
Flattens the sequence of Observables emitted by the source into one Observable, without any transformation.
Flattens the sequence of Observables emitted by the source into one Observable, without any transformation.
You can combine the items emitted by multiple Observables so that they act like a single Observable by using this method.
This operation is only available if this
is of type Observable[Observable[B]]
for some B
,
otherwise you'll get a compilation error.
an Observable that emits items that are the result of flattening the items emitted
by the Observables emitted by this
Applies a binary operator to a start value and all elements of this Observable,
going left to right and returns a new Observable that emits only one item
before onComplete
.
Applies a binary operator to a start value and all elements of this Observable,
going left to right and returns a new Observable that emits only one item
before onComplete
.
Returns an Observable that emits a single boolean, either true, in case the given predicate holds for all the items emitted by the source, or false in case at least one item is not verifying the given predicate.
Returns an Observable that emits a single boolean, either true, in case the given predicate holds for all the items emitted by the source, or false in case at least one item is not verifying the given predicate.
a function that evaluates the items emitted by the source Observable, returning true
if they pass the filter
an Observable that emits only true or false in case the given predicate holds or not for all the items
Only emits the first element emitted by the source observable, after which it's completed immediately.
Only emits the first element emitted by the source observable, after which it's completed immediately.
Emits the first element emitted by the source, or otherwise if the source is completed without
emitting anything, then the default
is emitted.
Emits the first element emitted by the source, or otherwise if the source is completed without
emitting anything, then the default
is emitted.
Only emits the last element emitted by the source observable, after which it's completed immediately.
Only emits the last element emitted by the source observable, after which it's completed immediately.
Returns an Observable that applies the given function to each item emitted by an Observable and emits the result.
Returns an Observable that applies the given function to each item emitted by an Observable and emits the result.
a function to apply to each item emitted by the Observable
an Observable that emits the items from the source Observable, transformed by the given function
Converts the source Observable that emits T
into an Observable
that emits Notification[T]
.
Converts the source Observable that emits T
into an Observable
that emits Notification[T]
.
NOTE: onComplete
is still emitted after an onNext(OnComplete)
notification
however an onError(ex)
notification is emitted as an onNext(OnError(ex))
followed by an onComplete
.
Takes the elements of the source Observable and emits the maximum value, after the source has completed.
Takes the elements of the source Observable and emits the maximum value, after the source has completed.
Takes the elements of the source Observable and emits the element that has
the maximum key value, where the key is generated by the given function f
.
Takes the elements of the source Observable and emits the element that has
the maximum key value, where the key is generated by the given function f
.
Merges the sequence of Observables emitted by the source into one Observable, without any transformation.
Merges the sequence of Observables emitted by the source into one Observable, without any transformation.
You can combine the items emitted by multiple Observables so that they act like a single Observable by using this method.
The difference between concat and merge is that concat
cares about ordering of
emitted items (e.g. all items emitted by the first observable in the sequence will come before
the elements emitted by the second observable), whereas merge
doesn't care about that
(elements get emitted as they come). Because of back-pressure applied to observables,
concat is safe to use in all contexts, whereas merge requires buffering.
WARNING: the buffer created by this operator is unbounded and can blow up the process if the data source is pushing events faster than what the observer can consume, as it introduces an asynchronous boundary that eliminates the back-pressure requirements of the data sources emitting events for merging downstream. Use with care.
an Observable that emits items that are the result of flattening the items emitted
by the Observables emitted by this
Merges the sequence of Observables emitted by the source into one Observable, without any transformation.
Merges the sequence of Observables emitted by the source into one Observable, without any transformation.
You can combine the items emitted by multiple Observables so that they act like a single Observable by using this method.
The difference between concat and merge is that concat
cares about ordering of
emitted items (e.g. all items emitted by the first observable in the sequence will come before
the elements emitted by the second observable), whereas merge
doesn't care about that
(elements get emitted as they come). Because of back-pressure applied to observables,
concat is safe to use in all contexts, whereas merge requires buffering.
WARNING: the buffer created by this operator is unbounded and can blow up the process if the data source is pushing events faster than what the observer can consume, as it introduces an asynchronous boundary that eliminates the back-pressure requirements of the data sources emitting events for merging downstream. Use with care.
the policy used for buffering, useful if you want to limit the buffer size and apply back-pressure, trigger and error, etc... see the available buffer policies.
an Observable that emits items that are the result of flattening the items emitted
by the Observables emitted by this
Creates a new Observable by applying a function that you supply to each item emitted by the source Observable, where that function returns an Observable, and then merging those resulting Observables and emitting the results of this merger.
Creates a new Observable by applying a function that you supply to each item emitted by the source Observable, where that function returns an Observable, and then merging those resulting Observables and emitting the results of this merger.
a function that, when applied to an item emitted by the source Observable, returns an Observable
an Observable that emits the result of applying the transformation function to each item emitted by the source Observable and merging the results of the Observables obtained from this transformation.
Takes the elements of the source Observable and emits the minimum value, after the source has completed.
Takes the elements of the source Observable and emits the minimum value, after the source has completed.
Takes the elements of the source Observable and emits the element that has
the minimum key value, where the key is generated by the given function f
.
Takes the elements of the source Observable and emits the element that has
the minimum key value, where the key is generated by the given function f
.
Converts this observable into a multicast observable, useful for turning a cold observable into a hot one (i.
Converts this observable into a multicast observable, useful for turning a cold observable into a hot one (i.e. whose source is shared by all observers).
Returns a new Observable that uses the specified ExecutionContext
for listening to the emitted items.
Returns a new Observable that uses the specified ExecutionContext
for listening to the emitted items.
Converts this observable into a multicast observable, useful for turning a cold observable into a hot one (i.
Converts this observable into a multicast observable, useful for turning a cold observable into a hot one (i.e. whose source is shared by all observers). The underlying subject used is a PublishSubject.
Applies a binary operator to a start value and all elements of this Observable,
going left to right and returns a new Observable that emits only one item
before onComplete
.
Applies a binary operator to a start value and all elements of this Observable,
going left to right and returns a new Observable that emits only one item
before onComplete
.
Repeats the items emitted by this Observable continuously.
Repeats the items emitted by this Observable continuously. It caches the generated items until onComplete
and repeats them ad infinitum. On error it terminates.
Converts this observable into a multicast observable, useful for turning a cold observable into a hot one (i.
Converts this observable into a multicast observable, useful for turning a cold observable into a hot one (i.e. whose source is shared by all observers). The underlying subject used is a ReplaySubject.
Wraps the observer implementation given to subscribeFn
into a SafeObserver.
Wraps the observer implementation given to subscribeFn
into a SafeObserver.
Normally wrapping in a SafeObserver
happens at the edges of the monad
(in the user-facing subscribe()
implementation) or in Observable subscribe implementations,
so this wrapping is useful.
Applies a binary operator to the first item emitted by a source Observable, then feeds the result of that function along with the second item emitted by the source Observable into the same function, and so on until all items have been emitted by the source Observable, emitting the result of each of these iterations.
Applies a binary operator to the first item emitted by a source Observable, then feeds the result of that function along with the second item emitted by the source Observable into the same function, and so on until all items have been emitted by the source Observable, emitting the result of each of these iterations.
Similar to reduce, but emits the state on each step. Useful for modeling finite state machines.
Applies a binary operator to a start value and all elements of this Observable, going left to right and returns a new Observable that emits on each step the result of the applied function.
Applies a binary operator to a start value and all elements of this Observable, going left to right and returns a new Observable that emits on each step the result of the applied function.
Similar to foldLeft, but emits the state on each step. Useful for modeling finite state machines.
Implicit scheduler required for asynchronous boundaries.
Implicit scheduler required for asynchronous boundaries.
Creates a new Observable that emits the given elements and then it also emits the events of the source (prepend operation).
Creates a new Observable that emits the given elements and then it also emits the events of the source (prepend operation).
Creates the subscription and starts the stream.
Creates the subscription and starts the stream.
Creates the subscription and starts the stream.
Creates the subscription and starts the stream.
Creates the subscription and starts the stream.
Creates the subscription and starts the stream.
Creates the subscription and starts the stream.
Creates the subscription and starts the stream.
Creates the subscription and that starts the stream.
Creates the subscription and that starts the stream.
is an Observer on which onNext
, onComplete
and onError
happens, according to the Monifu Rx contract.
Characteristic function for an Observable
instance,
that creates the subscription and that starts the stream,
being meant to be overridden in custom combinators
or in classes implementing Observable.
Characteristic function for an Observable
instance,
that creates the subscription and that starts the stream,
being meant to be overridden in custom combinators
or in classes implementing Observable.
is an Observer on which onNext
, onComplete
and onError
happens, according to the Monifu Rx contract.
Returns a new Observable that uses the specified ExecutionContext
for initiating the subscription.
Returns a new Observable that uses the specified ExecutionContext
for initiating the subscription.
Given a source that emits numeric values, the sum
operator
sums up all values and at onComplete it emits the total.
Given a source that emits numeric values, the sum
operator
sums up all values and at onComplete it emits the total.
Drops the first element of the source observable, emitting the rest.
Drops the first element of the source observable, emitting the rest.
Selects the first n elements (from the start).
Selects the first n elements (from the start).
the number of elements to take
a new Observable that emits only the first n elements from the source
Takes longest prefix of elements that satisfy the given predicate and returns a new Observable that emits those elements.
Takes longest prefix of elements that satisfy the given predicate and returns a new Observable that emits those elements.
Takes longest prefix of elements that satisfy the given predicate and returns a new Observable that emits those elements.
Takes longest prefix of elements that satisfy the given predicate and returns a new Observable that emits those elements.
Creates the subscription and that starts the stream.
Creates the subscription and that starts the stream.
This function is "unsafe" to call because it does not wrap the given observer implementation in a SafeObserver, like the other subscribe functions are doing.
is an Observer on which onNext
, onComplete
and onError
happens, according to the Monifu Rx contract.
Creates a new Observable from this Observable and another given Observable, by emitting elements combined in pairs.
Creates a new Observable from this Observable and another given Observable, by emitting elements combined in pairs. If one of the Observable emits fewer events than the other, then the rest of the unpaired events are ignored.
A
AsyncSubject
emits to a subscriber only those items that are emitted by the source subsequent to the time of the subscriptionIf the source terminates with an error, the
AsyncSubject
will not emit any items to subsequent subscribers, but will simply pass along the error notification from the source Observable.