Object/Trait

rx.lang.scala

Observable

Related Docs: trait Observable | package scala

Permalink

object Observable

Provides various ways to construct new Observables.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Observable
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def amb[T](sources: Observable[T]*): Observable[T]

    Permalink

    Mirror the one Observable in an Iterable of several Observables that first emits an item.

    Mirror the one Observable in an Iterable of several Observables that first emits an item.

    sources

    an Iterable of Observable sources competing to react first

    returns

    an Observable that emits the same sequence of items as whichever of the source Observables first emitted an item

  5. def apply[T](f: (Subscriber[T]) ⇒ Unit): Observable[T]

    Permalink

    Returns an Observable that will execute the specified function when someone subscribes to it.

    Returns an Observable that will execute the specified function when someone subscribes to it.

    Write the function you pass so that it behaves as an Observable: It should invoke the Subscriber's onNext, onError, and onCompleted methods appropriately.

    You can add custom Subscriptions to Subscriber. These Subscriptions will be called

    • when someone calls unsubscribe.
    • after onCompleted or onError.

    See Rx Design Guidelines (PDF) for detailed information.

    See RxScalaDemo.createExampleGood and RxScalaDemo.createExampleGood2.

    T

    the type of the items that this Observable emits

    f

    a function that accepts a Subscriber[T], and invokes its onNext, onError, and onCompleted methods as appropriate

    returns

    an Observable that, when someone subscribes to it, will execute the specified function

  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def combineLatest[T, R](sources: Iterable[Observable[T]])(combineFunction: (Seq[T]) ⇒ R): Observable[R]

    Permalink

    Combines an Iterable of source Observables by emitting an item that aggregates the latest values of each of the source Observables each time an item is received from any of the source Observables, where this aggregation is defined by a specified function.

    Combines an Iterable of source Observables by emitting an item that aggregates the latest values of each of the source Observables each time an item is received from any of the source Observables, where this aggregation is defined by a specified function.

    Backpressure:

    Fully supports backpressure.

    Scheduler:

    This method does not operate by default on a particular Scheduler.

    T

    the common base type of source values

    R

    the result type

    sources

    the Iterable of source Observables

    combineFunction

    the aggregation function used to combine the items emitted by the source Observables

    returns

    an Observable that emits items that are the result of combining the items emitted by the source Observables by means of the given aggregation function

    See also

    ReactiveX operators documentation: CombineLatest

  9. def combineLatestDelayError[T, R](sources: Iterable[Observable[T]])(combineFunction: (Seq[T]) ⇒ R): Observable[R]

    Permalink

    Combines an Iterable of source Observables by emitting an item that aggregates the latest values of each of the source Observables each time an item is received from any of the source Observables, where this aggregation is defined by a specified function and delays any error from the sources until all source Observables terminate.

    Combines an Iterable of source Observables by emitting an item that aggregates the latest values of each of the source Observables each time an item is received from any of the source Observables, where this aggregation is defined by a specified function and delays any error from the sources until all source Observables terminate.

    Backpressure:

    Fully supports backpressure.

    Scheduler:

    This method does not operate by default on a particular Scheduler.

    T

    the common base type of source values

    R

    the result type

    sources

    the Iterable of source Observables

    combineFunction

    the aggregation function used to combine the items emitted by the source [Observable]]s

    returns

    an Observable that emits items that are the result of combining the items emitted by the source Observables by means of the given aggregation function

    See also

    ReactiveX operators documentation: CombineLatest

  10. def defer[T](observable: ⇒ Observable[T]): Observable[T]

    Permalink

    Returns an Observable that calls an Observable factory to create its Observable for each new Observer that subscribes.

    Returns an Observable that calls an Observable factory to create its Observable for each new Observer that subscribes. That is, for each subscriber, the actual Observable is determined by the factory function.

    The defer operator allows you to defer or delay emitting items from an Observable until such time as an Observer subscribes to the Observable. This allows an rx.lang.scala.Observer to easily obtain updates or a refreshed version of the sequence.

    T

    the type of the items emitted by the Observable

    observable

    the Observable factory function to invoke for each rx.lang.scala.Observer that subscribes to the resulting Observable

    returns

    an Observable whose rx.lang.scala.Observers trigger an invocation of the given Observable factory function

  11. def empty: Observable[Nothing]

    Permalink

    Returns an Observable that emits no data to the rx.lang.scala.Observer and immediately invokes its onCompleted method with the specified scheduler.

    Returns an Observable that emits no data to the rx.lang.scala.Observer and immediately invokes its onCompleted method with the specified scheduler.

    returns

    an Observable that returns no data to the rx.lang.scala.Observer and immediately invokes the rx.lang.scala.Observerr's onCompleted method with the specified scheduler

    See also

    MSDN: Observable.Empty Method (IScheduler)

    RxJava Wiki: empty()

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  14. def error(exception: Throwable): Observable[Nothing]

    Permalink

    Returns an Observable that invokes an Observer.onError method when the Observer subscribes to it.

    Returns an Observable that invokes an Observer.onError method when the Observer subscribes to it.

    Scheduler:

    This method does not operate by default on a particular Scheduler.

    exception

    the particular Throwable to pass to Observer.onError

    returns

    an Observable that invokes the Observer.onError method when the Observer subscribes to it

    See also

    ReactiveX operators documentation: Throw

  15. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. def from[T](iterable: Iterable[T]): Observable[T]

    Permalink

    Converts an Iterable into an Observable.

    Converts an Iterable into an Observable.

    Note: the entire iterable sequence is immediately emitted each time an Observer subscribes. Since this occurs before the Subscription is returned, it is not possible to unsubscribe from the sequence before it completes.

    T

    the type of items in the Iterable sequence and the type of items to be emitted by the resulting Observable

    iterable

    the source Iterable sequence

    returns

    an Observable that emits each item in the source Iterable sequence

  17. def from[T](f: Future[T])(implicit execContext: ExecutionContext): Observable[T]

    Permalink

    Returns an Observable emitting the value produced by the Future as its single item.

    Returns an Observable emitting the value produced by the Future as its single item. If the future fails, the Observable will fail as well.

    f

    Future whose value ends up in the resulting Observable

    returns

    an Observable completed after producing the value of the future, or with an exception

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  20. def interval(initialDelay: Duration, period: Duration, scheduler: Scheduler): Observable[Long]

    Permalink

    Returns an Observable that emits a 0L after the initialDelay and ever increasing numbers after each period of time thereafter, on a specified Scheduler.

    Returns an Observable that emits a 0L after the initialDelay and ever increasing numbers after each period of time thereafter, on a specified Scheduler.

    Backpressure Support:

    This operator does not support backpressure as it uses time. If the downstream needs a slower rate it should slow the timer or use something like onBackpressureDrop.

    Scheduler:

    you specify which Scheduler this operator will use.

    initialDelay

    the initial delay time to wait before emitting the first value of 0L

    period

    the period of time between emissions of the subsequent numbers

    scheduler

    the Scheduler on which the waiting happens and items are emitted

    returns

    an Observable that emits a 0L after the initialDelay and ever increasing numbers after each period of time thereafter, while running on the given Scheduler

    See also

    ReactiveX operators documentation: Interval

  21. def interval(initialDelay: Duration, period: Duration): Observable[Long]

    Permalink

    Returns an Observable that emits a 0L after the initialDelay and ever increasing numbers after each period of time thereafter.

    Returns an Observable that emits a 0L after the initialDelay and ever increasing numbers after each period of time thereafter.

    Backpressure Support:

    This operator does not support backpressure as it uses time. If the downstream needs a slower rate it should slow the timer or use something like onBackpressureDrop.

    Scheduler:

    interval operates by default on the computation Scheduler.

    initialDelay

    the initial delay time to wait before emitting the first value of 0L

    period

    the period of time between emissions of the subsequent numbers

    returns

    an Observable that emits a 0L after the initialDelay and ever increasing numbers after each period of time thereafter

    See also

    ReactiveX operators documentation: Interval

  22. def interval(period: Duration, scheduler: Scheduler): Observable[Long]

    Permalink

    Emits 0, 1, 2, ... with a delay of duration between consecutive numbers.

    Emits 0, 1, 2, ... with a delay of duration between consecutive numbers.

    period

    duration between two consecutive numbers

    scheduler

    the scheduler to use

    returns

    An Observable that emits a number each time interval.

  23. def interval(duration: Duration): Observable[Long]

    Permalink

    Emits 0, 1, 2, ... with a delay of duration between consecutive numbers.

    Emits 0, 1, 2, ... with a delay of duration between consecutive numbers.

    duration

    duration between two consecutive numbers

    returns

    An Observable that emits a number each time interval.

  24. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  25. def just[T](items: T*): Observable[T]

    Permalink

    Converts a sequence of values into an Observable.

    Converts a sequence of values into an Observable.

    Implementation note: the entire array will be immediately emitted each time an rx.lang.scala.Observer subscribes. Since this occurs before the rx.lang.scala.Subscription is returned, it in not possible to unsubscribe from the sequence before it completes.

    T

    the type of items in the Array, and the type of items to be emitted by the resulting Observable

    items

    the source Array

    returns

    an Observable that emits each item in the source Array

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

    Permalink
    Definition Classes
    AnyRef
  27. def never: Observable[Nothing]

    Permalink

    Returns an Observable that never sends any items or notifications to an rx.lang.scala.Observer.

    Returns an Observable that never sends any items or notifications to an rx.lang.scala.Observer.

    This Observable is useful primarily for testing purposes.

    returns

    an Observable that never sends any items or notifications to an rx.lang.scala.Observer

  28. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  29. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  30. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  31. def timer(delay: Duration, scheduler: Scheduler): Observable[Long]

    Permalink

    Returns an Observable that emits 0L after a specified delay, on a specified Scheduler, and then completes.

    Returns an Observable that emits 0L after a specified delay, on a specified Scheduler, and then completes.

    delay

    the initial delay before emitting a single 0L

    scheduler

    the Scheduler to use for scheduling the item

    returns

    Observable that emits 0L after a specified delay, on a specified Scheduler, and then completes

  32. def timer(delay: Duration): Observable[Long]

    Permalink

    Returns an Observable that emits 0L after a specified delay, and then completes.

    Returns an Observable that emits 0L after a specified delay, and then completes.

    delay

    the initial delay before emitting a single 0L

    returns

    Observable that emits 0L after a specified delay, and then completes

  33. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  34. def using[T, Resource](resourceFactory: ⇒ Resource)(observableFactory: (Resource) ⇒ Observable[T], dispose: (Resource) ⇒ Unit, disposeEagerly: Boolean = false): Observable[T]

    Permalink

    Constructs an Observable that creates a dependent resource object.

    Constructs an Observable that creates a dependent resource object.

    Scheduler:

    using does not operate by default on a particular Scheduler.

    resourceFactory

    the factory function to create a resource object that depends on the Observable. Note: this is a by-name parameter.

    observableFactory

    the factory function to create an Observable

    dispose

    the function that will dispose of the resource

    disposeEagerly

    if true then disposal will happen either on unsubscription or just before emission of a terminal event (onComplete or onError).

    returns

    the Observable whose lifetime controls the lifetime of the dependent resource object

    Since

    (if this graduates from Experimental/Beta to supported, replace this parenthetical with the release number)

    See also

    MSDN: Observable.Using

    RxJava wiki: using

  35. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  38. def zip[T](observables: Observable[Observable[T]]): Observable[Seq[T]]

    Permalink

    Given an Observable emitting N source observables, returns an observable that emits Seqs of N elements each.

    Given an Observable emitting N source observables, returns an observable that emits Seqs of N elements each. The first emitted Seq will contain the first element of each source observable, the second Seq the second element of each source observable, and so on.

    Note that the returned Observable will only start emitting items once the given Observable[Observable[T]] has completed, because otherwise it cannot know N.

    observables

    An Observable emitting N source Observables

    returns

    an Observable that emits the zipped Seqs

  39. def zip[A, B, C, D](obA: Observable[A], obB: Observable[B], obC: Observable[C], obD: Observable[D]): Observable[(A, B, C, D)]

    Permalink

    Given 4 observables, returns an observable that emits Tuples of 4 elements each.

    Given 4 observables, returns an observable that emits Tuples of 4 elements each. The first emitted Tuple will contain the first element of each source observable, the second Tuple the second element of each source observable, and so on.

    returns

    an Observable that emits the zipped Observables

  40. def zip[A, B, C](obA: Observable[A], obB: Observable[B], obC: Observable[C]): Observable[(A, B, C)]

    Permalink

    Given 3 observables, returns an observable that emits Tuples of 3 elements each.

    Given 3 observables, returns an observable that emits Tuples of 3 elements each. The first emitted Tuple will contain the first element of each source observable, the second Tuple the second element of each source observable, and so on.

    returns

    an Observable that emits the zipped Observables

Deprecated Value Members

  1. def combineLatest[T, R](sources: Seq[Observable[T]])(combineFunction: (Seq[T]) ⇒ R): Observable[R]

    Permalink

    Combines a list of source Observables by emitting an item that aggregates the latest values of each of the source Observables each time an item is received from any of the source Observables, where this aggregation is defined by a specified function.

    Combines a list of source Observables by emitting an item that aggregates the latest values of each of the source Observables each time an item is received from any of the source Observables, where this aggregation is defined by a specified function.

    T

    the common base type of source values

    R

    the result type

    sources

    the list of source Observables

    combineFunction

    the aggregation function used to combine the items emitted by the source Observables

    returns

    an Observable that emits items that are the result of combining the items emitted by the source Observables by means of the given aggregation function

    Annotations
    @deprecated
    Deprecated

    (Since version 0.26.2) Use Observable.combineLatest[T,R](sources:Iterable[rx\.lang\.scala\.Observable[T]])(combineFunction:Seq[T]=>R):* instead

  2. def create[T](f: (Observer[T]) ⇒ Subscription): Observable[T]

    Permalink

    Creates an Observable that will execute the given function when an rx.lang.scala.Observer subscribes to it.

    Creates an Observable that will execute the given function when an rx.lang.scala.Observer subscribes to it.

    Write the function you pass to create so that it behaves as an Observable: It should invoke the Observer's onNext, onError, and onCompleted methods appropriately.

    See Rx Design Guidelines (PDF) for detailed information.

    T

    the type of the items that this Observable emits.

    f

    a function that accepts an Observer[T], invokes its onNext, onError, and onCompleted methods as appropriate, and returns a rx.lang.scala.Subscription to allow the Observer to canceling the subscription.

    returns

    an Observable that, when an rx.lang.scala.Observer subscribes to it, will execute the given function.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.26.2) Use Observable.apply instead

Inherited from AnyRef

Inherited from Any

Ungrouped