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
- Alphabetic
- By Inheritance
- BlockingObservable
- AnyVal
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
first: T
Returns the first item emitted by a specified Observable, or
NoSuchElementExceptionif source contains no elements.Returns the first item emitted by a specified Observable, or
NoSuchElementExceptionif source contains no elements.- returns
the first item emitted by the source Observable
- Exceptions thrown
java.util.NoSuchElementExceptionif source contains no elements- See also
-
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.RuntimeExceptionif an error occurs
-
def
getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
-
def
head: T
Returns the first item emitted by a specified Observable, or
NoSuchElementExceptionif source contains no elements.Returns the first item emitted by a specified Observable, or
NoSuchElementExceptionif source contains no elements.- returns
the first item emitted by the source Observable
- Exceptions thrown
java.util.NoSuchElementExceptionif source contains no elements- See also
-
def
headOption: Option[T]
Returns an
Optionwith the very first item emitted by the source Observable, orNoneif the source Observable is empty.Returns an
Optionwith the very first item emitted by the source Observable, orNoneif the source Observable is empty.- returns
an
Optionwith the very first item from the source, orNoneif the source Observable completes without emitting any item.
-
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.
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
last: T
Returns the last item emitted by a specified Observable, or throws
NoSuchElementExceptionif it emits no items.Returns the last item emitted by a specified Observable, or throws
NoSuchElementExceptionif it emits no items.
- returns
the last item emitted by the source Observable
- Exceptions thrown
java.util.NoSuchElementExceptionif source contains no elements- See also
-
def
lastOption: Option[T]
Returns an
Optionwith the last item emitted by the source Observable, orNoneif the source Observable completes without emitting any items.Returns an
Optionwith the last item emitted by the source Observable, orNoneif the source Observable completes without emitting any items.- returns
an
Optionwith the last item emitted by the source Observable, orNoneif the source Observable is empty
-
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
-
def
latest: Iterable[T]
Returns an
Iterablethat returns the latest item emitted by thisBlockingObservable, waiting if necessary for one to become available.Returns an
Iterablethat returns the latest item emitted by thisBlockingObservable, waiting if necessary for one to become available.If this
BlockingObservableproduces items faster thanIterator.nexttakes them,onNextevents might be skipped, butonErrororonCompletedevents are not.Note also that an
onNextdirectly followed byonCompletedmight hide theonNextevent.- returns
an
Iterablethat always returns the latest item emitted by thisBlockingObservable
-
def
mostRecent[U >: T](initialValue: U): Iterable[U]
Returns an
Iterablethat always returns the item most recently emitted by an Observable.Returns an
Iterablethat always returns the item most recently emitted by an Observable.
- initialValue
the initial value that will be yielded by the
Iterablesequence if the Observable has not yet emitted an item- returns
an
Iterablethat on each iteration returns the item that the Observable has most recently emitted
-
def
next: Iterable[T]
Returns an
Iterablethat blocks until the Observable emits another item, then returns that item.Returns an
Iterablethat blocks until the Observable emits another item, then returns that item.
- returns
an
Iterablethat blocks upon each iteration until the Observable emits a new item, whereupon the Iterable returns that item
- val o: Observable[T]
-
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
IllegalArgumentExceptionorNoSuchElementExceptionrespectively.
- returns
an Observable that emits the single item emitted by the source Observable
- Exceptions thrown
java.lang.IllegalArgumentExceptionif the source emits more than one itemjava.util.NoSuchElementExceptionif the source emits no items
-
def
singleOption: Option[T]
If the source Observable completes after emitting a single item, return an
Optionwith that item; if the source Observable is empty, returnNone.If the source Observable completes after emitting a single item, return an
Optionwith that item; if the source Observable is empty, returnNone. If the source Observable emits more than one item, throw anIllegalArgumentException.- returns
an
Optionwith the single item emitted by the source Observable, orNoneif the source Observable is empty
- Exceptions thrown
java.lang.IllegalArgumentExceptionif the source Observable emits more than one item
-
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.IllegalArgumentExceptionif the source Observable emits more than one item
-
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()
-
def
subscribe(observer: Observer[T]): Unit
EXPERIMENTAL Subscribes to the source and calls back the Observer methods on the current thread.
-
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()
-
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()
-
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()
-
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()
-
def
toFuture: Future[T]
Returns a
Futurerepresenting the single value emitted by thisBlockingObservable.Returns a
Futurerepresenting the single value emitted by thisBlockingObservable.The returned
Futurewill be completed with anIllegalArgumentExceptionif theBlockingObservableemits more than one item. And it will be completed with anNoSuchElementExceptionif theBlockingObservableis empty. UseObservable.toSeq.toBlocking.toFutureif you are not sure about the size ofBlockingObservableand do not want to handle theseExceptions.
- returns
a
Futurethat expects a single item to be emitted by thisBlockingObservable.
-
def
toIterable: Iterable[T]
Returns an
Iterablethat iterates over all items emitted by this Observable. -
def
toList: List[T]
Returns a
Listthat contains all items emitted by this Observable. -
def
toString(): String
- Definition Classes
- Any
- def withFilter(p: (T) ⇒ Boolean): WithFilter[T]