Package rx.singles

Class BlockingSingle<T>

java.lang.Object
rx.singles.BlockingSingle<T>
Type Parameters:
T - the value type of the sequence

@Experimental public final class BlockingSingle<T> extends Object
BlockingSingle is a blocking "version" of Single that provides blocking operators.

You construct a BlockingSingle from a Single with from(Single) or Single.toBlocking().

Since:
(if this graduates from Experimental/Beta to supported, replace this parenthetical with the release number)
  • Field Details

    • single

      private final Single<? extends T> single
  • Constructor Details

    • BlockingSingle

      private BlockingSingle(Single<? extends T> single)
  • Method Details

    • from

      @Experimental public static <T> BlockingSingle<T> from(Single<? extends T> single)
      Converts a Single into a BlockingSingle.
      Type Parameters:
      T - the value type of the sequence
      Parameters:
      single - the Single you want to convert
      Returns:
      a BlockingSingle version of single
    • value

      @Experimental public T value()
      Returns the item emitted by this BlockingSingle.

      If the underlying Single returns successfully, the value emitted by the Single is returned. If the Single emits an error, the throwable emitted (SingleSubscriber.onError(Throwable)) is thrown.

      Returns:
      the value emitted by this BlockingSingle
    • toFuture

      @Experimental public Future<T> toFuture()
      Returns a Future representing the value emitted by this BlockingSingle.
      Returns:
      a Future that returns the value