rx.lang.scala.observables

BlockingObservable

Related Doc: package observables

final class BlockingObservable[+T] extends AnyVal

An Observable that provides blocking operators.

You can obtain a BlockingObservable from an Observable using rx.lang.scala.Observable.toBlocking

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. BlockingObservable
  2. AnyVal
  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
    Any
  2. final def ##(): Int

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

    Definition Classes
    Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def first: T

    Returns the first item emitted by a specified Observable, or NoSuchElementException if source contains no elements.

    Returns the first item emitted by a specified Observable, or NoSuchElementException if source contains no elements.

    returns

    the first item emitted by the source Observable

    Exceptions thrown

    java.util.NoSuchElementException if source contains no elements

    See also

    MSDN: Observable.First

    RxJava Wiki: first()

  6. def foreach(f: (T) ⇒ Unit): Unit

    Invoke a method on each item emitted by the Observable; block until the Observable completes.

    Invoke a method on each item emitted by the Observable; block until the Observable completes.

    NOTE: This will block even if the Observable is asynchronous.

    This is similar to Observable.subscribe()*, but it blocks. Because it blocks it does not need the Observer.onCompleted or Observer.onError methods.

    f

    the action to invoke for every item emitted by the Observable

    Exceptions thrown

    java.lang.RuntimeException if an error occurs

  7. def getClass(): Class[_ <: AnyVal]

    Definition Classes
    AnyVal → Any
  8. def head: T

    Returns the first item emitted by a specified Observable, or NoSuchElementException if source contains no elements.

    Returns the first item emitted by a specified Observable, or NoSuchElementException if source contains no elements.

    returns

    the first item emitted by the source Observable

    Exceptions thrown

    java.util.NoSuchElementException if source contains no elements

    See also

    BlockingObservable.first

    MSDN: Observable.First

    RxJava Wiki: first()

  9. def headOption: Option[T]

    Returns an Option with the very first item emitted by the source Observable, or None if the source Observable is empty.

    Returns an Option with the very first item emitted by the source Observable, or None if the source Observable is empty.

    returns

    an Option with the very first item from the source, or None if the source Observable completes without emitting any item.

  10. def headOrElse[U >: T](default: ⇒ U): U

    Returns the very first item emitted by the source Observable, or a default value if the source Observable is empty.

    Returns the very first item emitted by the source Observable, or a default value if the source Observable is empty.

    default

    The default value to emit if the source Observable doesn't emit anything. This is a by-name parameter, so it is only evaluated if the source Observable doesn't emit anything.

    returns

    the very first item from the source, or a default value if the source Observable completes without emitting any item.

  11. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  12. def last: T

    Returns the last item emitted by a specified Observable, or throws NoSuchElementException if it emits no items.

    Returns the last item emitted by a specified Observable, or throws NoSuchElementException if it emits no items.

    returns

    the last item emitted by the source Observable

    Exceptions thrown

    java.util.NoSuchElementException if source contains no elements

    See also

    MSDN: Observable.Last

    RxJava Wiki: last()

  13. def lastOption: Option[T]

    Returns an Option with the last item emitted by the source Observable, or None if the source Observable completes without emitting any items.

    Returns an Option with the last item emitted by the source Observable, or None if the source Observable completes without emitting any items.

    returns

    an Option with the last item emitted by the source Observable, or None if the source Observable is empty

  14. def lastOrElse[U >: T](default: ⇒ U): U

    Returns the last item emitted by the source Observable, or a default item if the source Observable completes without emitting any items.

    Returns the last item emitted by the source Observable, or a default item if the source Observable completes without emitting any items.

    default

    the default item to emit if the source Observable is empty. This is a by-name parameter, so it is only evaluated if the source Observable doesn't emit anything.

    returns

    the last item emitted by the source Observable, or a default item if the source Observable is empty

  15. def latest: Iterable[T]

    Returns an Iterable that returns the latest item emitted by this BlockingObservable, waiting if necessary for one to become available.

    Returns an Iterable that returns the latest item emitted by this BlockingObservable, waiting if necessary for one to become available.

    If this BlockingObservable produces items faster than Iterator.next takes them, onNext events might be skipped, but onError or onCompleted events are not.

    Note also that an onNext directly followed by onCompleted might hide the onNext event.

    returns

    an Iterable that always returns the latest item emitted by this BlockingObservable

  16. def mostRecent[U >: T](initialValue: U): Iterable[U]

    Returns an Iterable that always returns the item most recently emitted by an Observable.

    Returns an Iterable that always returns the item most recently emitted by an Observable.

    initialValue

    the initial value that will be yielded by the Iterable sequence if the Observable has not yet emitted an item

    returns

    an Iterable that on each iteration returns the item that the Observable has most recently emitted

  17. def next: Iterable[T]

    Returns an Iterable that blocks until the Observable emits another item, then returns that item.

    Returns an Iterable that blocks until the Observable emits another item, then returns that item.

    returns

    an Iterable that blocks upon each iteration until the Observable emits a new item, whereupon the Iterable returns that item

  18. val o: Observable[T]

  19. def single: T

    If the source Observable completes after emitting a single item, return that item.

    If the source Observable completes after emitting a single item, return that item. If the source Observable emits more than one item or no items, notify of an IllegalArgumentException or NoSuchElementException respectively.

    returns

    an Observable that emits the single item emitted by the source Observable

    Exceptions thrown

    java.lang.IllegalArgumentException if the source emits more than one item

    java.util.NoSuchElementException if the source emits no items

  20. def singleOption: Option[T]

    If the source Observable completes after emitting a single item, return an Option with that item; if the source Observable is empty, return None.

    If the source Observable completes after emitting a single item, return an Option with that item; if the source Observable is empty, return None. If the source Observable emits more than one item, throw an IllegalArgumentException.

    returns

    an Option with the single item emitted by the source Observable, or None if the source Observable is empty

    Exceptions thrown

    java.lang.IllegalArgumentException if the source Observable emits more than one item

  21. def singleOrElse[U >: T](default: ⇒ U): U

    If the source Observable completes after emitting a single item, return that item; if the source Observable is empty, return a default item.

    If the source Observable completes after emitting a single item, return that item; if the source Observable is empty, return a default item. If the source Observable emits more than one item, throw an IllegalArgumentException.

    default

    a default value to emit if the source Observable emits no item. This is a by-name parameter, so it is only evaluated if the source Observable doesn't emit anything.

    returns

    the single item emitted by the source Observable, or a default item if the source Observable is empty

    Exceptions thrown

    java.lang.IllegalArgumentException if the source Observable emits more than one item

  22. def subscribe(subscriber: Subscriber[T]): Unit

    EXPERIMENTAL Subscribes to the source and calls the Subscriber methods on the current thread.

    EXPERIMENTAL Subscribes to the source and calls the Subscriber methods on the current thread.

    The unsubscription and backpressure is composed through.

    subscriber

    the Subscriber to forward events and calls to in the current thread

    Annotations
    @Experimental()
  23. def subscribe(observer: Observer[T]): Unit

    EXPERIMENTAL Subscribes to the source and calls back the Observer methods on the current thread.

    EXPERIMENTAL Subscribes to the source and calls back the Observer methods on the current thread.

    observer

    the Observer to call event methods on

    Annotations
    @Experimental()
  24. def subscribe(onNext: (T) ⇒ Unit, onError: (Throwable) ⇒ Unit, onCompleted: () ⇒ Unit): Unit

    EXPERIMENTAL Subscribes to the source and calls the given functions on the current thread.

    EXPERIMENTAL Subscribes to the source and calls the given functions on the current thread.

    onNext

    this function will be called whenever the Observable emits an item

    onError

    this function will be called if an error occurs

    onCompleted

    this function will be called when this Observable has finished emitting items

    Annotations
    @Experimental()
  25. def subscribe(onNext: (T) ⇒ Unit, onError: (Throwable) ⇒ Unit): Unit

    EXPERIMENTAL Subscribes to the source and calls the given functions on the current thread.

    EXPERIMENTAL Subscribes to the source and calls the given functions on the current thread.

    onNext

    this function will be called whenever the Observable emits an item

    onError

    this function will be called if an error occurs

    Annotations
    @Experimental()
  26. def subscribe(onNext: (T) ⇒ Unit): Unit

    EXPERIMENTAL Subscribes to the source and calls the given functions on the current thread, or rethrows any exception wrapped into rx.exceptions.OnErrorNotImplementedException.

    EXPERIMENTAL Subscribes to the source and calls the given functions on the current thread, or rethrows any exception wrapped into rx.exceptions.OnErrorNotImplementedException.

    onNext

    this function will be called whenever the Observable emits an item

    Annotations
    @Experimental()
  27. def subscribe(): Unit

    EXPERIMENTAL Runs the source observable to a terminal event, ignoring any values and rethrowing any exception.

    EXPERIMENTAL Runs the source observable to a terminal event, ignoring any values and rethrowing any exception.

    Annotations
    @Experimental()
  28. def toFuture: Future[T]

    Returns a Future representing the single value emitted by this BlockingObservable.

    Returns a Future representing the single value emitted by this BlockingObservable.

    The returned Future will be completed with an IllegalArgumentException if the BlockingObservable emits more than one item. And it will be completed with an NoSuchElementException if the BlockingObservable is empty. Use Observable.toSeq.toBlocking.toFuture if you are not sure about the size of BlockingObservable and do not want to handle these Exceptions.

    returns

    a Future that expects a single item to be emitted by this BlockingObservable.

  29. def toIterable: Iterable[T]

    Returns an Iterable that iterates over all items emitted by this Observable.

  30. def toList: List[T]

    Returns a List that contains all items emitted by this Observable.

  31. def toString(): String

    Definition Classes
    Any
  32. def withFilter(p: (T) ⇒ Boolean): WithFilter[T]

Inherited from AnyVal

Inherited from Any

Ungrouped