monifu.reactive

Observable

trait Observable[+T] extends AnyRef

Asynchronous implementation of the Observable interface

Self Type
Observable[T]
Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Observable
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. implicit abstract def scheduler: Scheduler

    Implicit scheduler required for asynchronous boundaries.

  2. abstract def subscribeFn(observer: Observer[T]): Unit

    Function that creates the actual subscription when calling subscribe, and that starts the stream, being meant to be overridden in custom combinators or in classes implementing Observable.

    Function that creates the actual subscription when calling subscribe, and that starts the stream, being meant to be overridden in custom combinators or in classes implementing Observable.

    observer

    is an Observer on which onNext, onComplete and onError happens, according to the Rx grammar.

    returns

    a cancelable that can be used to cancel the streaming

    Attributes
    protected

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ++[U >: T](other: ⇒ Observable[U]): Observable[U]

    Concatenates the source Observable with the other Observable, as specified.

  4. def +:[U >: T](elems: U*): Observable[U]

    Creates a new Observable that emits the given elements and then it also emits the events of the source (prepend operation).

  5. def :+[U >: T](elems: U*): Observable[U]

    Creates a new Observable that emits the events of the source and then it also emits the given elements (appended to the stream).

  6. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  7. final def asFuture: Future[Option[T]]

    Returns the first generated result as a Future and then cancels the subscription.

  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. final def behavior[U >: T](initialValue: U): ConnectableObservable[U]

    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.

  10. final def buffered: Observable[T]

    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, also making it thread-safe.

    WARNING: the JVM's process might blow up if the producer is emitting events too fast, because the buffer is unbounded.

  11. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  12. final def complete: Observable[Nothing]

    Returns an Observable that doesn't emit anything, but that completes when the source Observable completes.

  13. final def concat[U](implicit ev: <:<[T, Observable[U]]): Observable[U]

    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.

    returns

    an Observable that emits items that are the result of flattening the items emitted by the Observables emitted by this

  14. final def concatMap[U](f: (T) ⇒ Observable[U]): Observable[U]

    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.

    f

    a function that, when applied to an item emitted by the source Observable, returns an Observable

    returns

    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.

  15. def distinct[U](fn: (T) ⇒ U): Observable[T]

    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.

  16. def distinct: Observable[T]

    Suppress the duplicate elements emitted by the source Observable.

    Suppress the duplicate elements emitted by the source Observable.

    WARNING: this requires unbounded buffering.

  17. def distinctUntilChanged[U](fn: (T) ⇒ U): Observable[T]

    Suppress duplicate consecutive items emitted by the source Observable

  18. def distinctUntilChanged: Observable[T]

    Suppress duplicate consecutive items emitted by the source Observable

  19. final def doOnComplete(cb: ⇒ Unit): Observable[T]

    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().

    cb

    the callback to execute when the subscription is canceled

  20. final def doWork(cb: (T) ⇒ Unit): Observable[T]

    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.

    returns

    a new Observable that executes the specified callback for each element

  21. final def drop(n: Int): Observable[T]

    Drops the first n elements (from the start).

    Drops the first n elements (from the start).

    n

    the number of elements to drop

    returns

    a new Observable that drops the first n elements emitted by the source

  22. final def dropWhile(p: (T) ⇒ Boolean): Observable[T]

    Drops the longest prefix of elements that satisfy the given predicate and returns a new Observable that emits the rest.

  23. final def dump(prefix: String): Observable[T]

    Utility that can be used for debugging purposes.

  24. def endWith[U >: T](elems: U*): Observable[U]

    Creates a new Observable that emits the events of the source and then it also emits the given elements (appended to the stream).

  25. final def endWithError(error: Throwable): Observable[T]

    Emits the given exception instead of onComplete.

    Emits the given exception instead of onComplete.

    error

    the exception to emit onComplete

    returns

    a new Observable that emits an exception onComplete

  26. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  27. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  28. final def error: Observable[Throwable]

    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.

  29. final def exists(p: (T) ⇒ Boolean): Observable[Boolean]

    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.

    p

    a function that evaluates the items emitted by the source Observable, returning true if they pass the filter

    returns

    an Observable that emits only true or false in case the given predicate holds or not for at least one item

  30. final def filter(p: (T) ⇒ Boolean): Observable[T]

    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.

    p

    a function that evaluates the items emitted by the source Observable, returning true if they pass the filter

    returns

    an Observable that emits only those items in the original Observable for which the filter evaluates as true

  31. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  32. final def find(p: (T) ⇒ Boolean): Observable[T]

    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.

    p

    a function that evaluates the items emitted by the source Observable, returning true if they pass the filter

    returns

    an Observable that emits only the first item in the original Observable for which the filter evaluates as true

  33. final def firstOrElse[U >: T](default: ⇒ U): Observable[U]

    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.

  34. final def flatMap[U](f: (T) ⇒ Observable[U]): Observable[U]

    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.

    f

    a function that, when applied to an item emitted by the source Observable, returns an Observable

    returns

    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.

  35. final def flatten[U](implicit ev: <:<[T, Observable[U]]): Observable[U]

    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.

    returns

    an Observable that emits items that are the result of flattening the items emitted by the Observables emitted by this

  36. final def foldLeft[R](initial: R)(op: (R, T) ⇒ R): Observable[R]

    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.

  37. final def forAll(p: (T) ⇒ Boolean): Observable[Boolean]

    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.

    p

    a function that evaluates the items emitted by the source Observable, returning true if they pass the filter

    returns

    an Observable that emits only true or false in case the given predicate holds or not for all the items

  38. final def foreach(cb: (T) ⇒ Unit): Unit

  39. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  40. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  41. final def head: Observable[T]

    Only emits the first element emitted by the source observable, after which it's completed immediately.

  42. final def headOrElse[B >: T](default: ⇒ B): Observable[B]

    Emits the first element emitted by the source, or otherwise if the source is completed without emitting anything, then the default is emitted.

  43. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  44. final def last: Observable[T]

    Only emits the last element emitted by the source observable, after which it's completed immediately.

  45. final def map[U](f: (T) ⇒ U): Observable[U]

    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.

    f

    a function to apply to each item emitted by the Observable

    returns

    an Observable that emits the items from the source Observable, transformed by the given function

  46. final def materialize: Observable[Notification[T]]

    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.

  47. final def max[U >: T](implicit ev: Ordering[U]): Observable[U]

    Takes the elements of the source Observable and emits the maximum value, after the source has completed.

  48. final def maxBy[U](f: (T) ⇒ U)(implicit ev: Ordering[U]): Observable[T]

    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.

  49. final def merge[U](implicit ev: <:<[T, Observable[U]]): Observable[U]

    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.

    returns

    an Observable that emits items that are the result of flattening the items emitted by the Observables emitted by this

  50. final def mergeMap[U](f: (T) ⇒ Observable[U]): Observable[U]

    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.

    f

    a function that, when applied to an item emitted by the source Observable, returns an Observable

    returns

    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.

  51. final def min[U >: T](implicit ev: Ordering[U]): Observable[T]

    Takes the elements of the source Observable and emits the minimum value, after the source has completed.

  52. final def minBy[U](f: (T) ⇒ U)(implicit ev: Ordering[U]): Observable[T]

    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.

  53. final def multicast[R](subject: Subject[T, R]): ConnectableObservable[R]

    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).

  54. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  55. final def notify(): Unit

    Definition Classes
    AnyRef
  56. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  57. final def observeOn(s: Scheduler): Observable[T]

    Returns a new Observable that uses the specified ExecutionContext for listening to the emitted items.

  58. final def publish(): ConnectableObservable[T]

    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.

  59. final def reduce[U >: T](op: (U, U) ⇒ U): Observable[U]

    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.

  60. final def repeat: Observable[T]

    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.

  61. final def replay(): ConnectableObservable[T]

    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.

  62. final def safe: Observable[T]

    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.

  63. final def scan[U >: T](op: (U, U) ⇒ U): Observable[U]

    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.

  64. final def scan[R](initial: R)(op: (R, T) ⇒ R): Observable[R]

    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.

  65. def startWith[U >: T](elems: U*): Observable[U]

    Creates a new Observable that emits the given elements and then it also emits the events of the source (prepend operation).

  66. final def subscribe(): Unit

    Helper to be used by consumers for subscribing to an observable.

  67. final def subscribe(nextFn: (T) ⇒ Future[Ack]): Unit

    Helper to be used by consumers for subscribing to an observable.

  68. final def subscribe(nextFn: (T) ⇒ Future[Ack], errorFn: (Throwable) ⇒ Unit): Unit

    Helper to be used by consumers for subscribing to an observable.

  69. final def subscribe(nextFn: (T) ⇒ Future[Ack], errorFn: (Throwable) ⇒ Unit, completedFn: () ⇒ Unit): Unit

    Helper to be used by consumers for subscribing to an observable.

  70. final def subscribe(observer: Observer[T]): Unit

  71. final def subscribeOn(s: Scheduler): Observable[T]

    Returns a new Observable that uses the specified ExecutionContext for initiating the subscription.

  72. final def sum[U >: T](implicit ev: Numeric[U]): Observable[U]

    Given a source that emits numeric values, the sum operator sums up all values and at onComplete it emits the total.

  73. final def sync: Observable[T]

    An alias for buffered.

    An alias for buffered. 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, also making it thread-safe.

    WARNING: the JVM's process might blow up if the producer is emitting events too fast, because the buffer is unbounded.

  74. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  75. final def tail: Observable[T]

    Drops the first element of the source observable, emitting the rest.

  76. final def take(n: Int): Observable[T]

    Selects the first n elements (from the start).

    Selects the first n elements (from the start).

    n

    the number of elements to take

    returns

    a new Observable that emits only the first n elements from the source

  77. final def takeRight(n: Int): Observable[T]

  78. final def takeWhile(isRefTrue: Atomic[Boolean]): Observable[T]

    Takes longest prefix of elements that satisfy the given predicate and returns a new Observable that emits those elements.

  79. final def takeWhile(p: (T) ⇒ Boolean): Observable[T]

    Takes longest prefix of elements that satisfy the given predicate and returns a new Observable that emits those elements.

  80. def toString(): String

    Definition Classes
    AnyRef → Any
  81. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  82. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  83. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  84. final def zip[U](other: Observable[U]): Observable[(T, U)]

    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.

Inherited from AnyRef

Inherited from Any

Ungrouped