rx.lang.scala

Observable

Related Docs: trait Observable | package scala

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
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

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

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

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

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

    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]

    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

    Definition Classes
    Any
  7. def clone(): AnyRef

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

    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

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

    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.

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

    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]

    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

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

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

    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

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

    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]

    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[_]

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

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

    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]

    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]

    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]

    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

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

    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

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

    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

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

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

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

    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]

    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

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

    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

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

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

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

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

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

    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

Inherited from AnyRef

Inherited from Any

Ungrouped