rx.lang.scala

Observable

object Observable

Provides various ways to construct new Observables.

Linear Supertypes
AnyRef, Any
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: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

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

    Definition Classes
    Any
  6. 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

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

  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. 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

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

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

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

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

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

    Definition Classes
    AnyRef → Any
  16. 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

  17. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. 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

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

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

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

    Definition Classes
    AnyRef → Any
  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 timer(initialDelay: Duration, period: Duration, scheduler: Scheduler): Observable[Long]

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

    Return an Observable that emits a 0L after the initialDelay and ever increasing numbers after each period of time thereafter, on a specified 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

    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

  34. def timer(initialDelay: Duration, period: Duration): Observable[Long]

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

    Return an Observable that emits a 0L after the initialDelay and ever increasing numbers after each period of time thereafter, on a specified 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, while running on the given scheduler

  35. def toString(): String

    Definition Classes
    AnyRef → Any
  36. 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

  37. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. 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

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

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